Sunday, 25 February 2018

How to call client side function from Server side or vice versa in VB.Net

1st option

ClientScript.RegisterClientScriptBlock(Page, typeof"Validate(ID), true);

OR

<asp:Button OnClientClick = "Validate(ID)"/>

Use this on page load:

RegisterStartupScript("Unique key", "Validate(ID);");

2nd option

protected void MyButton_Click(object sender, EventArgs e)
{
    Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "AnotherFunction();", true);
}



No comments:

Post a Comment