You probably know that each ASP.NET Ajax page MUST have ONLY ONE ScriptManager control.
No more, no less.
If you try to add more than one ScriptManager to ASP.NET page you will receive error:
"Only one instance of a ScriptManager can be added to the page."
Because of this, its common (and recommended) practice to use this approach:
Create MasterPage, and place ScriptManager control on it and then use this instance on each of ContentPages.
here is the code that you can place on your ContentPage to retrieve an instance of ScriptManager from MasterPage:
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
Showing posts with label master page. Show all posts
Showing posts with label master page. Show all posts
Tuesday, May 19, 2009
Monday, April 20, 2009
Using body onload with ASP.net MasterPages
we want to use body onload tag in master pages but it will have effect other content pages.The onload function is for only one content page.for this purpose we have used below code in master page.
Master Page :
<script language="javascript">
function masterpage_onload()
{
if(window.content_onload != null)
window.content_onload();
//this condition check whether the rendered page has function are not.
}
</script>
Content Page :
<script language="javascript">
function content_onload()
{
//do something
}
</script>
Master Page :
<script language="javascript">
function masterpage_onload()
{
if(window.content_onload != null)
window.content_onload();
//this condition check whether the rendered page has function are not.
}
</script>
Content Page :
<script language="javascript">
function content_onload()
{
//do something
}
</script>
Friday, December 5, 2008
Find control in aspx page which has master page
Its easy to find the control in apsx page but we need to write
extra code when we have a master page for the aspx page.
Below is the code which finds control in aspx page which has master page.
Dim content As ContentPlaceHolder
content = Page.Master.FindControl("ContentPlaceHolder1")
Dim labelcontrol As Label
labelcontrol = content.FindControl("LabelId")
labelcontrol .Visible = False
using above code we can find the control.
extra code when we have a master page for the aspx page.
Below is the code which finds control in aspx page which has master page.
Dim content As ContentPlaceHolder
content = Page.Master.FindControl("ContentPlaceHolder1")
Dim labelcontrol As Label
labelcontrol = content.FindControl("LabelId")
labelcontrol .Visible = False
using above code we can find the control.
Subscribe to:
Posts (Atom)