Answered by:
AJAX control doesn't seem to do partial page update.

Question
-
User-753400859 posted
I'm trying to do a very simple partial page update with a TextBox control using the TextChanged event to fire the update. Everything works, except its doing a full page post pack rather than a partial page update. I don't want the entire page to post back, what can I do to make this work. Here is the code in question:
<asp:UpdatePanel ID="usernamePanel" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
<Triggers>
d <asp:AsyncPostBackTrigger EventName="TextChanged" ControlID="username" />
</Triggers>
<ContentTemplate>
<asp:PlaceHolder ID="notUniqueUsername" runat="Server" Visible="false"><font color="red">Username already in use. Please select another one.</font></asp:PlaceHolder>
<asp:ValidationSummary ID="Validationsummary2" Runat="server" ShowSummary="true" DisplayMode="BulletList" HeaderText="b>" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:TextBox width="300" MaxLength="25" ID="username" AutoPostBack="true" TextMode="SingleLine" Runat="server" /><asp:UpdatePanel id="<span" class="st"><Triggers><ContentTemplate><asp:TextBox width="<span" class="st"></asp:TextBox></ContentTemplate></Triggers></asp:UpdatePanel>
Tuesday, November 20, 2007 12:26 PM
Answers
-
User-753400859 posted
The script manager tag is in there, just not in the sample code that I posted. Its near the top of the page after the form tag.
I think what I need to do it create a plain-jane page and then try the samples that are posted all over the place. That way I can confirm that it actually works. (I tried upgrading my existing .NET app to use ajax.)
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, November 21, 2007 9:48 AM
All replies
-
User-1684099974 posted
Place the textbox inside of the updatepanel's contenttemplate. If a control which causes postback is not in an updatepanel, it's going to cause a visible refresh. Adding it as a trigger to an updatepanel does nothing to stop that. It's the updatepanel itself that hides the refresh, not being a trigger.
Tuesday, November 20, 2007 2:43 PM -
User-753400859 posted
Even if I stick the code in the updatepanel, I still get a full page refresh. Checking scriptmanager1.IsAsyncPostBack shows false.
<asp:UpdatePanel ID="usernamePanel" UpdateMode="Always" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="username" EventName="TextChanged" /> </Triggers> <ContentTemplate> <asp:TextBox width="300" MaxLength="25" OnTextChanged="usernameCheck" ID="username" TextMode="SingleLine" Runat="server" /> <asp:PlaceHolder ID="notUniqueUsername" runat="Server" Visible="false"><font color="red">Username already in use.</font></asp:PlaceHolder> </ContentTemplate> </asp:UpdatePanel>
Tuesday, November 20, 2007 4:50 PM -
User770037084 posted
If a control which causes postback is not in an updatepanel, it's going to cause a visible refresh. Adding it as a trigger to an updatepanel does nothing to stop that. It's the updatepanel itself that hides the refresh, not being a trigger.AsyncPostBackTriggers don't have to be inside an UpdatePanel. Try this code, for example:
<asp:ScriptManager runat="server" ID="sm1" />
<asp:Button runat="server" ID="Button1" OnClick="Button1_Click" />
<asp:UpdatePanel runat="server" ID="up1">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
<ContentTemplate>
<asp:Literal runat="server" ID="Literal1" />
</ContentTemplate>
</asp:UpdatePanel>protected void Button1_Click(object sender, EventArgs e)
Clicking Button1 results in a partial postback, not a full one.
{
Literal1.Text = DateTime.Now.ToString();
}Tuesday, November 20, 2007 5:31 PM -
User770037084 posted
I'm trying to do a very simple partial page update with a TextBox control using the TextChanged event to fire the update. Everything works, except its doing a full page post pack rather than a partial page update. I don't want the entire page to post back, what can I do to make this work. Here is the code in question:Try removing the EventName qualifier on your AsyncPostBackTrigger declaration.
Tuesday, November 20, 2007 5:32 PM -
User-1623675128 posted
Where is your ScriptManager TAG in your code????
Thanks,
Wednesday, November 21, 2007 12:03 AM -
User-753400859 posted
The script manager tag is in there, just not in the sample code that I posted. Its near the top of the page after the form tag.
I think what I need to do it create a plain-jane page and then try the samples that are posted all over the place. That way I can confirm that it actually works. (I tried upgrading my existing .NET app to use ajax.)
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, November 21, 2007 9:48 AM