Login Control, Default Button, ugh.

Yes, you can definitely find this information elsewhere but...what happens when you want to use a login control on a page and also use the default button property so when a user hits enter it submits the login control's button.  Nothing, because you have no idea what the hell the ID of the submit button is. 

Here is the workaround:

<asp:LinkButton ID="lnkbtn1" runat="server" />
<asp:Panel ID="pnlLogin" runat="server" style="display:none" CssClass="modalPopup"  DefaultButton="Login1$LoginButton"  >
     <div class="modaltext">
    <label id="modalTextMessage" ></label>
    <asp:Login ID="Login1" runat="server" Width="246px" >
    </asp:Login>
    <asp:button id="btnCancel" runat="server" text="Cancel" />
    </div>
</asp:Panel>
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted @ Friday, August 08, 2008 4:34 PM

Twitter