Javascript function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
there is a way to call a java function (in a javascript file) on click of a webcontrol in c#
thank you
Fabrizi
 
Add an Attribute in the code-behind.
txtFirstName.Attributes.Add("onclick","fnJavaScriptCall()");

You could also write the client script in the code-behind like this:
public void writeScript()
{
string script = "<script language=\"javascript\">";
script += "function fnJavaScriptCall(){";
script += " Code...";
script += " }";
script += "</script>";
this.Page.RegisterStartupScript(script);
}

Regards,
-Brian K. Williams
 
Back
Top