Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback
Submit Button doesn't fire postback Submit Button doesn't fire postback
Submit Button doesn't fire postback
Go Back  Xtreme Visual Basic Talk > > > Submit Button doesn't fire postback


Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2008, 06:26 PM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default Submit Button doesn't fire postback


Hello,

I have a master page with the site layout all worked up in tables and div tags and such. In a little gap within this page is a Content Place Holder. In a content page I have again a complex web of tables and div tags and at the bottom there's a submit button. But sadly, the submit button doesn't fire a postback.

When I try to force the onClick event to the button, pressing it gives me an error to register the control for raising the post back event. I then try to register this event in the render stage of the page and then I'm back to square one... The submit button doesn't fire a postback.

Has anyone ran into this same problem? Can anyone offer any help in resolving this issue?

Thanks to all for their help.
Reply With Quote
  #2  
Old 12-22-2008, 09:32 PM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

Delete the button, put a new one on the form. Should work. VB doesn't use onClick. It's just ButtonWhatever.Click. onClick is JavaScript. If you're using onClick, make sure you have the JavaScript to accompany it; otherwise, you would get an error.
Reply With Quote
  #3  
Old 12-23-2008, 01:54 AM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default

Hi Targe,

Thanks for your reply. Well, removing the button and placing a new one in it's place didn't work. I have the code embedded witin the aspx document. Here is the control code and the rendered html code...

Server Control:
HTML Code:
<asp:Button ID="SubmitBtn" runat="server" Text="submit" OnClick="SubmitBtn_Click" />
Rendered Control:
HTML Code:
<input type="submit" name="ctl00$ContentSpace$SubmitBtn" value="submit" id="ctl00_ContentSpace_SubmitBtn" />
They both look legit to me. I tried having the content page pull a different master page (a plain master page) and the button worked. It seems my complicated master page (the original page) is throw'n off the post back. Does anyone know if this might be true? If so, what is something I can do to fix this? --> On the master page, the div tags match up, the table tags match up. This makes me believe it's not the layout... But I might be wrong??
Reply With Quote
  #4  
Old 12-23-2008, 02:37 AM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

Debug the event's first line. If it's not firing on postback then remove the Handles SubmitBtn.Click from the event. This is most likely caused from your Master Page AutoEventWireup being enabled. It could even be an update panel causing this behavior, though that is doubtful.

Also, you should be aware that .NET conventions ask that you put the btn prefix before the Submit, i.e. btnSubmit versus SubmitBtn.

If you're still having problems, post some code behind of the event and master page directives. Also give the containers the button is in.
Reply With Quote
  #5  
Old 12-24-2008, 04:01 AM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default

Targe,

Thanks very much for your continued help.
The button pressing wasn't triggering ANY postback. I then tried adding a simple button on the master layout. That didn't work. So I then tried removing the entire layout and piecing it back together. The button would work initially but then failed as soon as I added a section of HTML code that contained a form in it. I removed the second form and continued adding the entire site layout back to normal. The button now works. So, I believe my whole problem was the addition of another form on my site. Is that true? Only one form per page or the whole thing falls apart?

For example...
HTML Code:
<form id="form1" runat="server">
    <form method="get" ... ...>
    </form>
</form>
Reply With Quote
  #6  
Old 12-25-2008, 02:50 AM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

Yes, only 1 form per page. Good to hear it works!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback Submit Button doesn't fire postback
Submit Button doesn't fire postback
Submit Button doesn't fire postback
 
Submit Button doesn't fire postback
Submit Button doesn't fire postback
 
-->