Thursday, March 7, 2013

OnKeyUp event in ASP.Net

How about the text entered by you in the textbox (ASP.NET) should be postback and the every entered char should be read in Code Behind class.\

It might be used for look up instantaneously in DB.Table.

This is done by calling the OnKeyUp event.

Sample code snippet.

   protected void Page_Load(object sender, EventArgs e)  
   {     
     TextBox1.Attributes.  
             Add("onkeyup",Page.  
             ClientScript.  
             GetPostBackEventReference(TextBox1, ""));      
     Response.Write(TextBox1.Text);  
   }  

No comments:

Post a Comment

Code Formater

Paste Here Your Source Code
Source Code Formatting Options
1) Convert Tab into Space :
2) Need Line Code Numbering :
3) Remove blank lines :
4) Embeded styles / Stylesheet :
5) Code Block Width :
6) Code Block Height :
7) Alternative Background :
Copy Formatted Source Code
 
Preview Of Formatted Code