Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Login control with layout template

hondaman2003 (Programmer)
28 Feb 12 23:07
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>
MarkSweetland (MIS)
29 Feb 12 11:10


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

hondaman2003 (Programmer)
29 Feb 12 11:13
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?
MarkSweetland (MIS)
29 Feb 12 12:01

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: http://mattberseth.com/blog/2007/07/indepth_the_updatepanel_aspnet.html]


     Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach

hondaman2003 (Programmer)
29 Feb 12 12:20
That makes a lot of sense.  Based on that, the login button in the panel should only post back the panel, correct?
MarkSweetland (MIS)
29 Feb 12 13:14

Correct.  It get s a bit more involved when there are nested UpdatePanels.  Here's another link that goes into detail about the UpdatePanels:

http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers


     Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach

hondaman2003 (Programmer)
29 Feb 12 13:19
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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close