Tuesday, December 11, 2012

How to add JavaScript at runtime using C#

string Script=@”function ShowName() { var txt=document.getElementById(‘txtName’); alert(‘Your name is: ‘+txt.value); }”; 

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), “ShowName”, Script, true);

0 comments:

Post a Comment