There are many ways to call JS function in code behind, one of them is:
protected void MyButton_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "SomeJSFunction();", true);
textID.Text =SomeFunction();
textName.Text = "SomeRandomeText";
}
public String SomeFunction()
{
count += 1;
return count.ToString();
}
Try this , it will work for you.
Thanks