This post has been edited by penn.nila: 13 October 2008 - 10:24 PM
Accessing a code behind function on keypress eventAccessing a code behind function on keypress event
Page 1 of 1
4 Replies - 7646 Views - Last Post: 14 October 2008 - 07:06 AM
#1
Accessing a code behind function on keypress event
Posted 13 October 2008 - 10:21 PM
I havent wriiten an code. i just wanted to know how to call a codebehind function on keypress even in c#. is it possible to call a server side function when a key in? Please give me the code snippets example of any text box keypress event. syntaxt of the event call.
Replies To: Accessing a code behind function on keypress event
#2
Re: Accessing a code behind function on keypress event
Posted 14 October 2008 - 02:59 AM
If you just double click it in design view it will automatically add a method called void TextBox1_TextChanged()
That's the function that you should edit~

(Note that if you want to do it yourself, you can)
this.textBox1.TextChanged += new System.EventHandler(myEventHandler);
Then, your event handler function should look like this:
Hope this helps
That's the function that you should edit~
(Note that if you want to do it yourself, you can)
this.textBox1.TextChanged += new System.EventHandler(myEventHandler);
Then, your event handler function should look like this:
void myEventHandler(object sender, EventArgs e) {
// do stuff here
}
Hope this helps
#3
Re: Accessing a code behind function on keypress event
Posted 14 October 2008 - 03:23 AM
Hey dude!
Thanks a lot for the swift reply.
Cheers, GBU.
Thanks a lot for the swift reply.
Cheers, GBU.
gabehabe, on 14 Oct, 2008 - 02:59 AM, said:
If you just double click it in design view it will automatically add a method called void TextBox1_TextChanged()
That's the function that you should edit~

(Note that if you want to do it yourself, you can)
this.textBox1.TextChanged += new System.EventHandler(myEventHandler);
Then, your event handler function should look like this:
Hope this helps
That's the function that you should edit~
(Note that if you want to do it yourself, you can)
this.textBox1.TextChanged += new System.EventHandler(myEventHandler);
Then, your event handler function should look like this:
void myEventHandler(object sender, EventArgs e) {
// do stuff here
}
Hope this helps
#4
Re: Accessing a code behind function on keypress event
Posted 14 October 2008 - 05:38 AM
I don't think that is what you want to do. since you said "server side function", I will assume this is in ASP.Net(you probably should have posted this in the ASP.Net forum). calling a server side function will cause you to do a postback. doing a postback on every keypress is HIGHLY inefficient.
you will want to use javascript.
you will want to use javascript.
#5
Re: Accessing a code behind function on keypress event
Posted 14 October 2008 - 07:06 AM
Didn't see that bit
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote








|