CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 3/18/2008 10:54:43 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 75 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
motoBeast
Asp.Net User
asp net onload event problem3/18/2008 10:54:43 PM

0

i don't know if this problem should be here but here it is:

i have a asp.net site and with a masterpage and many content pages. i
have a problem using Google Maps JavaScript API. in content page i use
<body onload="load()" onunload="GUnload()"> and it use to work. The
problem is that i had to put javascript functions in masterpage and
used <body id="mBody" onload="javascript:preloader();". Now the google
maps API doesn't work because of the 2 onload events(in masterpage and
contentpage). How to solve this? I looked up for solutions:

Set your masterpage body tag to:

<body id="mBody" runat="server">

Then add this on any page that uses the master and wants to access the
body tag:

public void Page_Load(Object sender, EventArgs e)
{
//Inject onload and unload
HtmlGenericControl body =
(HtmlGenericControl)Master.FindControl("mBody");
body.Attributes.Add("onload", "Function1()");
body.Attributes.Add("onunload", "Function2()");

}

but this just work if there is any onload event already in masterpage.

also tried to put onload event of google map in a table like this <table onload="load()"....but doesnt work. 

can someone get a solution please?

thanks in advance

NavaidAkhtar
Asp.Net User
Re: asp net onload event problem3/18/2008 11:18:26 PM

0

Hmm

You can use you Child Page onload too.

<script type="text/javascript" >Sys.Application.add_load(your function);</script>

You have to use this line in the content page. similarly you can also use add_UnLoad, and so on...


Sincerely,
Naveed Akhtar

Microsoft Certified Professional Developer
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Please remember to click ?Mark as Answer?, if it is solution to your Problem
koese
Asp.Net User
Re: asp net onload event problem3/18/2008 11:20:43 PM

0

try both the onLoan events on the mater page and avoide on content page

 <BODY onLoad="javascript:alert('First Action');alert('Second Action');">


koese
MorningZ
Asp.Net User
Re: asp net onload event problem3/19/2008 2:22:27 AM

0

That will only work is MS Ajax is installed

 

I'd recommend using JavaScript to attach the load events, see this excellent js function to use:

http://simonwillison.net/2004/May/26/addLoadEvent/

 


"If you make it idiot proof, they'll build a better idiot"
motoBeast
Asp.Net User
Re: asp net onload event problem3/20/2008 1:19:45 PM

0

koese:

try both the onLoan events on the mater page and avoide on content page

 <BODY onLoad="javascript:alert('First Action');alert('Second Action');">

 

 

 

i already tried that but if i do that it walways shows a javascript error in the masterpage, i don't know why...it says it has an objecto required but i dont know what object. i can't debug it.

5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning Ajax with ASP.NET Authors: Wallace B. McClure, Scott Cate, Paul Glavich, Craig Shoemaker, Pages: 403, Published: 2006
Distributed data applications with ASP.NET Authors: Alex Homer, David Sussman, Pages: 786, Published: 2004
ASP.NET 2.0 Website programming: problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Silverlight 2 Recipes: A Problem-Solution Approach Authors: Jit Ghosh, Rob Cameron, Pages: 616, Published: 2008
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007

Web:
asp net onload event problem - ASP.NET Forums i have a asp.net site and with a masterpage and many content pages. i ... but this just work if there is any onload event already in ...
body onload event - timing problem? - ASP.NET Forums way to get the onload event of a page to work? Wally -- Wallace B. McClure "The Harder I Work, the Luckier I Get." Listen to "The ASP.NET ...
ASP.NET Page Life Cycle Overview When an ASP.NET page runs, the page goes through a life cycle in which it ... Use the OnLoad event method to set properties in controls and establish .... Use this event to set text in the control that explains the problem or to direct ...
Visual Studio .NET No Focus from onload event When I add the onLoad event to the myBody tag - it is there, .... I don't know of the other methods that are built into asp.net control to set ... So the problem seems to be that you can't do an inline focus if the ...
15 Seconds : The ASP.NET Page Life Cycle So let's examine in detail the ten events of an ASP.NET page, from creation to disposal ... Figure 3 - The OnLoad event is an ideal location to place logic. ...

Setting onload event in body for a given content page - ng.asp-net ... Add multiple dynamic onload events to body tag : asp.net, internet . ... Problem with Flash Version check - macromedia.dreamweaver When it ...
WebPart and page onload - ng.asp-net-forum ... Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, ... Not able to add ScriptManager contol to Onload event of webpart . ...
Link Button in the Header Template - ng.asp-net-forum.windows ... Link Button in the Header Template, > ROOT > NEWSGROUP > Asp.Net Forum ... in which my control could lose the events. But still the problem is presistent. ... when the Dynamic controls are added in the onLoad event ? ...
Setting body.onload - ng.asp-net-forum.windows-hosting_open_forum Setting body.onload, > ROOT > NEWSGROUP > Asp.Net Forum ... I'm trying to set an onload event text for the body element at runtime, and this is what I'm ...
EventHandler problem - ng.asp-net-forum.web_forms EventHandler problem, > ROOT > NEWSGROUP > Asp.Net Forum ... Java Script Onload Event Handler Problem [Archive] - CodingForums.com [Archive] Java Script ...






frame refresh

coonnection

have a problem with sending mail in c#

remote desktop client - can we use it in asp.net?

determining runtime environment

syntax error (missing operator) in query expression 'id ='.

็how to validate input for textbox?

build linkbutton event in rowcommand

how to cope with html tags when update'ing an editable datagrid?

best place to save a db connection string?

having access to webcontrols from a class

posting values

julian dates...sort of

asp.net 1.1 how to diable back button?

question on data binding...

query string questions

unchanged url

type system

page_unload behaviour? ...

turning query results into specific strings

how does outlook open automaticaly?

select text in textbox on focus

auto dialer using asp.net 2.0

email body

popup error checking

application settings

issue with sending html mail

gridview templates optional columns requiredfieldvalidator

how to move a dll file to the gac?

what the type of <textbox>.text

   
  Privacy | Contact Us
All Times Are GMT