1. Javascript function override
Add body onLoad() event in the master page and override the function used in the event in the inherited content pages.
Say,
in master page
<html>
<head>
<script language=" javascript" type=" text/javascript">
function testonload(){ //an empty function
var x = 'empty';
}
</script>
</head>
.
..
...
....
.....
in content page
<asp:content id="Content1" runat="Server" contentplaceholderid="ContentPlaceHolder1">
<script language="javascript" type="text/javascript">
function testonload(prodid, div) {
//client script logic goes here..!!
}
</script>
2. Bind client script to body in code behind
Give an id to the body tag of the masgter page and add runat="server" sot that it is available in the code behind.
Now in content pages, add the following code in the page_load event
HtmlGenericControl body = (HtmlGenericControl)Page.Master.FindControl("bodyMaster");
body.Attributes.Add("onload", "toggle('parameters');");
Keep coding,
Add body onLoad() event in the master page and override the function used in the event in the inherited content pages.
Say,
in master page
<html>
<head>
<script language=" javascript" type=" text/javascript">
function testonload(){ //an empty function
var x = 'empty';
}
</script>
</head>
.
..
...
....
.....
in content page
<asp:content id="Content1" runat="Server" contentplaceholderid="ContentPlaceHolder1">
<script language="javascript" type="text/javascript">
function testonload(prodid, div) {
//client script logic goes here..!!
}
</script>
2. Bind client script to body in code behind
Give an id to the body tag of the masgter page and add runat="server" sot that it is available in the code behind.
Now in content pages, add the following code in the page_load event
HtmlGenericControl body = (HtmlGenericControl)Page.Master.FindControl("bodyMaster");
body.Attributes.Add("onload", "toggle('parameters');");
Keep coding,
No comments:
Post a Comment