Feb 03, 2021 11:25 PM|anjaliagarwal5@yahoo.com|LINK
I want to show a hidden panel when a user tabs out of a text box. I want to do this asynchronously. I wrote the following code. In below code my <asp:Panel is on another part of the page. Its not right above the updatePanel. I just put the panel above my
textbox code for simplicity.
<form id="form1" runat="server" method="post">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Panel runat="server" ID="pnlTest" Visible="false">
This is a test
</asp:Panel>
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate >
<asp:TextBox ID="txtTest" runat="server" OnTextChanged="txtestChanged" AutoPostBack="true"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID ="txtTest" />
</Triggers>
</asp:UpdatePanel>
</form>
Async post back in web forms still proceeds the whole page life cycle as if it's a traditional post. the difference is only the updated content inside target update panel that will be sent in response.
Therefore, it will not affect the content outside the UpdatePanel. If you need to achieve the requirements you mentioned, you need to change it to a full page postback ( PostBackTrigger ).
Page: <form id="form1" runat="server" method="post">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Panel runat="server" ID="pnlTest" Visible="false">
This is a test
</asp:Panel>
<asp:UpdatePanel ID="up1" runat="server" >
<ContentTemplate>
<asp:TextBox ID="txtTest" runat="server" OnTextChanged="txtestChanged" AutoPostBack="true"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="txtTest" />
</Triggers>
</asp:UpdatePanel>
</form>
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
511 Points
1274 Posts
showing a hidden panel in OnTextChanged event
Feb 03, 2021 11:25 PM|anjaliagarwal5@yahoo.com|LINK
I want to show a hidden panel when a user tabs out of a text box. I want to do this asynchronously. I wrote the following code. In below code my <asp:Panel is on another part of the page. Its not right above the updatePanel. I just put the panel above my textbox code for simplicity.
any help will be greatly appreciated.
All-Star
52683 Points
15720 Posts
Re: showing a hidden panel in OnTextChanged event
Feb 04, 2021 02:26 AM|oned_gk|LINK
AFAIK, the textbox should be outside update panel, then the panel is inside update panel. The code similar when you are not using ajax.
Suwandi - Non Graduate Programmer
Contributor
2110 Points
674 Posts
Re: showing a hidden panel in OnTextChanged event
Feb 04, 2021 02:44 AM|XuDong Peng|LINK
Hi anjaliagarwal5,
Async post back in web forms still proceeds the whole page life cycle as if it's a traditional post. the difference is only the updated content inside target update panel that will be sent in response.
Therefore, it will not affect the content outside the UpdatePanel. If you need to achieve the requirements you mentioned, you need to change it to a full page postback ( PostBackTrigger ).
Or put the panel in another UpdatePanel and use the update() function.
Best regards,
Xudong Peng