jQuery and ASP.NET

February 21, 2009

Add OnKeyUp to an ASP.NET TextBox




Here's a simple technique to add OnKeyUp to an ASP.NET Textbox. In the Page_Load add the following code:

C#


    protected void Page_Load(object sender, EventArgs e)


    {


        TextBox1.Attributes.Add("onKeyUp", "CallScript(this)");


    }






VB.NET


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)


        TextBox1.Attributes.Add("onKeyUp", "CallScript(this)")


    End Sub




'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

2 Responses to "Add OnKeyUp to an ASP.NET TextBox"
  1. PD said...
    November 19, 2009 9:10 AM

    what is "CallScript" in this context? A method in the code-behind file?

  2. Anonymous said...
    November 20, 2009 5:56 AM

    CallScript is a JavaScript method

 

Copyright © 2009-2011 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions