How To Add OnBlur Or OnFocus To A TextBox In The Codebehind



TODO:

Have you ever wanted to add the onblur or onfocus event to a TextBox in the Codebehind?


SOLUTION:

//add focus
myTextbox.Attributes.Add("onfocus", "MyJavascriptFocusFunction(this);");

//add blur
myTextbox.Attributes.Add("onblur", "MyJavascriptBlurFunction(this);");

 

NOTES:

There are no notes on this topic.