Tuesday, June 8, 2010

How to register the JavaScript function at Code-Behind

Use ResterStartupScript
this.Page.ClientScript.RegisterStartupScript(this.GetType(),"alert","<script>alert(‘hello’);</script>");
Use Literal control,
private void Button2_Click(object sender, System.EventArgs e)
{
    string str;
    str="<script language='JavaScript'>";
    str+="selectRange()";
    str+="<script>";
    Literal1.Text=str;
}

No comments:

Post a Comment