asp.net - OnTextChanged event is not firing -
i have textbox inside aspx page
<ajax:updatepanel id="updatepanel2" runat="server"> <contenttemplate> <asp:textbox id="txtcity" autopostback="true" ontextchanged="txtcity_textchanged" width="90%" runat="server" ></asp:textbox> </contenttemplate> </ajax:updatepanel> code behind:
protected void txtcity_textchanged(object sender, eventargs e) { lblmessage.text = "you have typed:" + txtcity.text; ; } and lblmessage [on same aspx page]
<ajax:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <contenttemplate> <asp:label id="lblmessage" runat="server" text="" ></asp:label> </contenttemplate> </ajax:updatepanel> but when typing in textbox. lblmessage not updating.
how rectify this?
it sounds you're thinking ontextchange event fired while typing in text box. not true. ontextchange server-side event , fires when page (or panel) posted back. typing text box on page not post page , event fire once submit form.
what want in case, use javascript onkeypress javascript event update label text things typed textbox. javascript run on client , doesn't require post page in order run.
Comments
Post a Comment