CodeVerge.Net Beta
Login Idy
Register Password
  Forgot?
Explore    Item Entry    Members   
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 5/9/2007 2:42:29 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 11 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
JayMan
Asp.Net User
defaultbutton Property with Master Page5/9/2007 2:42:29 PM

0/0

Hello everyone,

I have a master page that handles login for my users.  I would my users to be able to enter their user name and password, and then hit enter to login rather than just clicking the login button.  So I have placed my login controls in a panel control and set the defaultbutton property to the ID of the login button.  Now, when I run my app, I get this error:

The DefaultButton of 'LoginPanel' must be the ID of a control of type IButtonControl.

Is there something I am missing here? 

My code is as follows:

<

asp:Panel runat="server" ID="LoginPanel" defaultbutton="LoginButton2">

<asp:LoginView ID="lv1" runat="server">

<AnonymousTemplate>

<asp:Login ID="Login1" runat="server">

<LayoutTemplate>

<h3 class="none">

Log into ACRDC Site

</h3>

<fieldset>

<legend class="none">Log into ACRDC Site</legend>

<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User name:</asp:Label>

<br />

<asp:TextBox ID="UserName" runat="server" Width="112px"></asp:TextBox>

<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"

ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1" ForeColor="White">*This field is required</asp:RequiredFieldValidator>

<br />

<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>

<br />

<asp:TextBox ID="Password" runat="server" TextMode="Password" Width="112px"></asp:TextBox>

<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"

ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1" ForeColor="White">* This field is required</asp:RequiredFieldValidator>

<br />

<asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />

<p>

</p>

 

<asp:ImageButton ID="LoginButton" runat="server" commandname="Login" ValidationGroup="Login1" ImageUrl="images/LoginButton.gif" />

<br />

<asp:Button ID="LoginButton2" runat="server" commandname="Login" ValidationGroup="Login1" Visible="true" />

 

<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>

</fieldset>

</LayoutTemplate>

</asp:Login>

Fogot you password?

<br />

<asp:HyperLink ID="HyperLink1" runat="server" ForeColor="Blue" NavigateUrl="~/Login.aspx">Click Here</asp:HyperLink>

</AnonymousTemplate>

<LoggedInTemplate>

You are logged in!

<h3>

Hello

<asp:LoginName ID="LoginName1" runat="server" />

</h3>

<p>

Welcome back to the ACRDC website.

</p>

</LoggedInTemplate>

</asp:LoginView>

</asp:Panel>

Any help would be greatly appreciated.

Thanks


JayMan
Amanda Wang - M
Asp.Net User
Re: defaultbutton Property with Master Page5/11/2007 6:13:21 AM

0/0

Hi,

In the masterpage,

LoginButton2 looks good at first, but if you search for it in the code, you won't find a control with an Id of LoginButton2. You do, however, find this:

<input type="submit" name="Login1$LoginButton2" value="Log In" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;Login1$LoginButton&quot;, &quot;&quot;, true, &quot;Login1&quot;, &quot;&quot;, false, false))" id="Login1_LoginButton2" />

Because the page is based on a Master Page, the HTML name and id attributes have been prefixed with the names of their naming container, the ContentPlaceHolder1 in this case. 

you also could write in the code behind: this.Panel1.DefaultButton = this.Login1.FindControl("LoginButton").UniqueID;

The more information please click following link:  http://www.spaanjaars.com/QuickDocId.aspx?QUICKDOC=374

 


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
2 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

How to make Panel 'visible' programmatically using findcontrol ... I developed a page outside of my Master page, where I was using FindControl successfully. ... Panel Visible="false" DefaultButton="Button2" ID="Panel1 ...
HtmlForm.DefaultButton Property (System.Web.UI.HtmlControls) ... property from a content page, use the UniqueID property ... ASP.NET Master Pages Overview. DefaultButton Property. DefaultFocus Property. Enctype Property ...
Master Page Default Button bug not working with a TextBox that uses a ... ... ASP.NET AJAX Control Toolkit " Master Page Default Button bug not working with ... I also set the SetFocusOnError property to True for the masked edit validator. ...
Feedback: DefaultButton error when button is not in master page. Page.Form.DefaultButton = "SubmitButton" works find when that button exists in ... The documentation for the DefaultButton property of the HtmlForm control was ...
How Do I Set the DefaultFocus or DefaultButton in a Page Based on a ... Explains how to use the new ASP.NET 2.0 DefaultFocus and DefaultButton features in pages based on a Master Page. ... with setting a panel's defaultbutton ...
DefaultButton property - Set default button in ASP.NET page with Master ... ... default button for the Form in ASP.NET 2.0.BRBR[CODE]Page.Form.DefaultButton ... DefaultButton property - Set default button in ASP.NET page with Master Page ...
Chris Love's Official Blog - Professional ASP.NET : Utlizing ... ... an ASP.NET 2.0 page with the DefaultFocus property, but had not ... Protected Property DefaultButton() As String. Get. If Not IsNothing(Master.Page) Then ...
Default Focus, Buttons and Validation Errors with ASP.NET 2.0 ... Cause content page with the same master page but do not want the defualt ... with no page transition the page promptly 'forgets' the defaultbutton property. ...


 
All Times Are GMT