Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I want to update my update panel for different textbox textchanged events.....
Plz help me......

Thank You
Posted
Comments
AshishChaudha 2-Jul-12 1:53am    
didn't understand whats your requirement!!! What you have done??

It is strange to know that even after adding update panel / AsyncPostBackTrigger , TextBox ChangeEvent doesn't work properly. Some time its works and some times it not..Since its is Asynchronous call, we need to some time refresh, or wait or unpredictable , Hopes Microsoft will come up with competent one.. Below are easy way to check user name pretty good

In Page_Load-aspx.cs

C#
this.TextBox1.Attributes.Add("onKeyUp", "fnUNameSubmit(this);");


In aspx -add script, you code:

XML
<script language="javascript" type="text/javascript">

function fnUNameSubmit(urInput) {
var inpt= urInput.value;
if (inpt.length > 21) {
document.getElementById('<%= TextBox1.ClientID %>').style.backgroundColor = "green";
document.form1.submit();  // This is only trick we use here..
}
else {
document.getElementById('<%= TextBox1.ClientID %>').style.backgroundColor = "red";
}
  }
</script>
 
Share this answer
 
v2
I want to update my update panel for different textbox textchanged events
I believe you mean you want to update a updatepanel from text change event of a textbox that is not inside that updatepanel.
If so, you need to define AsyncPostbackTrigger of the update panel for that textbox textchange event with textbox autopostback property set to true.

Try:
HTML
<asp:TextBox ID="TextBox1" AutoPostback="true" runat="server"></asp:TextBox>
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
    <Triggers>
      <asp:AsyncPostBackTrigger ControlID="TextBox1" EventName="TextChanged"  />
    </Triggers>
    <ContentTemplate>
        <hr />
        <asp:Label ID="Label1" runat="server"/>
    </ContentTemplate>
</asp:UpdatePanel>

Refer: MSDN: AsyncPostBackTrigger Class[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900