Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login control with layout template

Status
Not open for further replies.

hondaman2003

Programmer
Mar 3, 2008
202
0
0
US
I have a login control with a layout template. I have read that AJAX should work with a partial page update but mine is not working. It does a full postback.

Here is my code:

Code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
    <asp:LoginView ID="LoginView1" runat="server">
    <AnonymousTemplate>
      <asp:Login ID="Login1" runat="server" Width="200px" >
      <LayoutTemplate>
        <asp:Label ID="Label1" runat="server" AssociatedControlID="UserName">User Name:</asp:Label><br />
        <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl00$ctl01$Login1" EnableClientScript="False">*</asp:RequiredFieldValidator><br />
        <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label><br />
        <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
        <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl00$ctl01$Login1" EnableClientScript="False">*</asp:RequiredFieldValidator><br />
        <asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." /><br />
        <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal><br />
        <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="ctl00$ctl01$Login1" />
      </LayoutTemplate>
      </asp:Login>
    </AnonymousTemplate>
    <LoggedInTemplate>
        Welcome <asp:LoginName ID="LoginName1" runat="server" Font-Bold="True" /><br /><br />
       Add Photos<br />
        <asp:LoginStatus ID="LoginStatus1" runat="server" />
    </LoggedInTemplate>
    </asp:LoginView>
  </ContentTemplate>
</asp:UpdatePanel>
 


Set the UpdateMode="Conditional" in the UpdatePanel.


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
I understand that making that change will prevent the update panel from updating unless certain conditions are met but why would a button within that panel be affected by that when the button would cause some type of postback anyway in either setting?
 
The UpdateMode property of the UpdatePanel can be set to either Always or Conditional, but if neither are supplied it will default to Always. When the value is Always, a postback from any other control on the page will cause the contents of the panel to be updated. If the control that causes the post-back was marked as an asynchronous post-back trigger, only the contents of the panel is updated, otherwise the complete page - including the panel is updated.

Source: ]


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
That makes a lot of sense. Based on that, the login button in the panel should only post back the panel, correct?
 
Based on that, my code above shows it setup exactly like that. I have my update panel (no nested panels) the login button is in the update panel and clicking that button causes a full postback, not just an async postback.

I understand what changing the setting to conditional will do but the full post back is happening from within the updatepanel. My understanding is that this should only be a partial update by clicking that button inside the update panel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top