Thursday 2 February 2012

asp:Panel not showing, ignoring Visible=true

In trying to add a Panel around an asp:Login control today so that I could add a DefaultButton I lost my login form completely!


<asp:Panel ID="pan_login" runat="server" DefaultButton="btn_login">
 
<asp:Login ID="LoginMain" runat="server" VisibleWhenLoggedIn="true" OnLoginError="LoginMain_LoginError" onauthenticate="LoginMain_Authenticate">

Nothing displayed at all!

Baffled, I eventually compared it to another site we had it working on and the solution was annoying to say the least... I had missed the reference to the Login control in my DefaultButton . Should have been DefaultButton="LoginMain$btn_login".


<asp:Panel ID="pan_login" runat="server" DefaultButton="LoginMain$btn_login">
 
<asp:Login ID="LoginMain" runat="server" VisibleWhenLoggedIn="true" OnLoginError="LoginMain_LoginError" onauthenticate="LoginMain_Authenticate">

Aaaaargh! ;-)

No comments:

Post a Comment