Skip to content

Instantly share code, notes, and snippets.

@sohel-rana
Created October 30, 2013 06:06
Show Gist options
  • Save sohel-rana/7227836 to your computer and use it in GitHub Desktop.
Save sohel-rana/7227836 to your computer and use it in GitHub Desktop.
ContentPlaceHolder cp = (ContentPlaceHolder)Page.Master.FindControl("CPH");
TextBox tbName = (TextBox)cp.FindControl("txtName");
TextBox tbAge = (TextBox)cp.FindControl("txtAge");
string script=string.Format(@"function IDIssue() {{ var txtName=document.getElementById('{0}'); var txtAge=document.getElementById('{1}'); alert('your name is '+ txtName.value+' and age is '+txtAge.value); }}",tbName.ClientID, tbAge.ClientID);
ClientScript.RegisterClientScriptBlock(this.GetType(), "IDIssue", script, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment