TextChange Event on a collection of textboxes [modified]
-
I have a collection of 50 textboxes. I was wounding if it is possible to run a TextChange Event on a collection of textboxes instead having to add each event handler in individually. The code behind is VB
modified on Tuesday, March 24, 2009 12:02 PM
-
I have a collection of 50 textboxes. I was wounding if it is possible to run a TextChange Event on a collection of textboxes instead having to add each event handler in individually. The code behind is VB
modified on Tuesday, March 24, 2009 12:02 PM
Hi, If the text boxes are not dynamic then it is very easy to make that as : so on and so forth .... in code behind protected void TextBox_TextChanged(object sender, EventArgs e) { TextBox txt = ((System.Web.UI.WebControls.TextBox)(sender)); } you can easily get which textbox changed event is called Regards, Milind
-
I have a collection of 50 textboxes. I was wounding if it is possible to run a TextChange Event on a collection of textboxes instead having to add each event handler in individually. The code behind is VB
modified on Tuesday, March 24, 2009 12:02 PM
U must have assigned ID to all of ur textboxes whether u create it dynamically or us it beforehand as a static control so u can create a centralized event handler for all ur textboxes for eg. if i have two textboxes with their ID as say t1 and t2 respectively then i will use this method to act as a centralized event handler for textchange d event of both as void TextBox_TextChanged(object sender,EventArgs e) { TextBox t = (TextBox)sender; switch(t.ID) { case "t1": Response.Write("Text Changed in t1"); break; case "t2": Response.Write("TextChanged in t2"); break; } }