Monday, 9 September 2013

Buttons not firing

Buttons not firing

I have an ASP.NET app which seems to be misbehaving and I have no idea
why. It has an ASP usercontrol with buttons on it - actually Telerik
buttons but when I use standard ASP:BUTTONs the result is the same.
The plan is that the buttons control a page number which then controls
which panel is displayed, like a wizard. But when the buttons are clicked
the events don't seem to be firing. After the second click the panel is
cleared. Breakpoints in the event code don't seem to be hit and the result
is identical if I comment the event code out.
I know I can do this in Javascript (my preference actually) but this is
working fine on a virtually identical page so I should be able to get this
to work.
The controls look as follows:
<asp:Panel ID="Page1" runat="server" style="display:block;">
<h3>Page 1 of 4 - your details</h3>
<br />
...
</asp:Panel>
<asp:Panel ID="Page2" runat="server" style="display:block;">
<h3>Page 2 of 4 - Company details</h3>
<br/>
<p>Enter information about your organisation.</p>
<br/>
...
</asp:Panel>
<asp:Panel ID="Page3" runat="server" style="display:block;">
<h3>Page 3 of 4</h3>
<br />
<p>Validate application</p>
...
<br />
</asp:Panel>
<asp:Panel ID="Page4" runat="server" style="display:block;">
<h3>Request complete</h3>
<br />
...
</asp:Panel>
<div id="ButtonSet"
<br />
<br />
<telerik:RadButton runat="server" ID="rb_Back"
Text="Back"></telerik:RadButton>
<telerik:RadButton runat="server" ID="rb_Next"
Text="Next"></telerik:RadButton>
<telerik:RadButton runat="server" ID="rb_Finish"
Text="Finish"></telerik:RadButton>
</div>
The server code looks as follows (when not commented out):
Protected Sub rb_Next_Click(sender As Object, e As EventArgs) Handles
rb_Next.Click
CurrentPage += 1
SetupTabs() ' <== hides/shows the appropriate panels
End Sub
Protected Sub rb_Back_Click(sender As Object, e As EventArgs) Handles
rb_Back.Click
CurrentPage -= 1
SetupTabs()
End Sub
The controls are set to AutoPostback=True and CausesValidation=True, which
is the same as the code which works.
Any help would be very gratefully received!

No comments:

Post a Comment