I have a checkbox name Checkbox2 runat server, if we try to get value by calling ID= Checkbox2 using javascipt, javascript error: Object not found, this is because server side ID is different with the client side ID. Client side ID for this object is Checkbox2.ClientID.
For example, i need to pass Checkbox2 value to a javascript function during page load, this is what i do.
protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterStartupScript("Onload", "<script language='javascript'>fnCheck('" + Checkbox2.ClientID +"');</script>");
}
fnCheck is a javascript function that i already define some where.
No comments:
Post a Comment