Started out for a way to find ClientId of Asp.Net Button in javascript code.
Interesting find is Page.ClientScript.RegisterClientScriptBlock() which registers variables and allows them to use in javascript on client side.
Sample:
Do the following on Page_Load Event of any page
var RegisteredVar= string.Format("var _Button1ClientId='{0}';", Button1.ClientID); Page.ClientScript.RegisterClientScriptBlock(GetType(), "AddScriptVariables", RegisteredVar, true);
Good to use the variable "RegisteredVar" in any javascript function.
No comments:
Post a Comment