5 Ocak 2010 Salı

Textbox does not fire TextChanged Event in User Controls...

TextChanged event is fired when the mouse leaves the textbox. This means that to fire that event you have to click on another object in the page after typing a character . To get rid of this extra click you can do this:

 protected void Page_Load(object sender, EventArgs e)
{
       if (!IsPostBack)
       {
         TextBox1.Attributes.Add("OnKeyUp", "javascript:myPostBack()");
        }
}

and paste the following code to your html file under the head tag:

< script type="text/javascript" >
function myPostBack()
{  
  __doPostBack("","");
}
< /script >



After that in every keystroke, TextChanged event will be fired by textbox...

Yours sincerely

Hiç yorum yok:

Yorum Gönder