- We can register and call the Javascript while the page load event using the 'Page.ClientScript.RegisterStartupScript()' method.
-If you want intimate some inforamtion before user viewing the page we can use this kind of Ajax style javascript calling.
Setps
1. Create a Javascript eighter in design page or inline javascript string for calling the RegisterStartupScript method.
2. Write the Page Load event and use the page.ClientScript.RegisterStartupScript.
example:
function SetPanelHeight(gvCellMaster) {
if (document.getElementById(gvCellMaster) != null) {
if (document.getElementById(gvCellMaster).clientHeight > 410) {
document.getElementById('gvCellMaster').style.height = "410px";
}
}
}
//In Code behind Page( i.e .cs page) of the Page Load event
//This bellow function calls the Javascript of SetPanelHeight
//Change the Grid
protected void page_Load(object sender, EventArgs e) {
string jscript = "";
jscript = "";
Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", jscript);
}



Read User's Comments