[mapguide-users] Ajax Viewer and iFrames in ASP.NET - has
anyone perfected this?
Brad L
bradl at mai-eng.com
Tue Oct 2 14:40:08 EDT 2007
You will probably have to use a client side script for this since the frames
are loading on the client. I don't know if this is the best way but I use
onload event of a frame with size zero in the same frameset as my viewer.
<frameset rows="*,0" border="0" framespacing="0">
<!--<frame src="/mapguide/mapviewernet/AJAXviewer.aspx?SESSION=<%=
sessionID %>&WEBLAYOUT=<%=webLayout %>" name="ViewerFrame" />-->
<frame src="/mapguide/mapviewernet/AJAXviewer.aspx?SESSION=<%= sessionID
%>&WEBLAYOUT=<%=webLayout %>" name="ViewerFrame" />
<frame src="blank.htm" onload="check_map();"/>
<!--<frame />-->
</frameset>
I then set an interval in javascript
function check_map()
{
initMap=setInterval('loadWatchInitialized()',200);
//set the interval to whatever you need
}
my interval checks to see when certain frames in the viewer are loaded
function loadWatchInitialized()
{
if (findexists('ViewerFrame')){
if(mapframeexists('formFrame')){
if(ViewerFrame.mapFrame.mapInit)
{
clearInterval(initMap);
create_Map();
}
}
}
}
function findexists(what) {
for (var i=0;i<window.frames.length;i++) {
if (window.frames[i].name == what)
return true;
}
return false;
}
function mapframeexists(what) {
for (var i=0;i<ViewerFrame.frames.length;i++) {
if (ViewerFrame.frames[i].name == what);
return true;
}
return false;
}
I can then load my .net code into the formframe of the viewer to execute
function create_Map()
{
ViewerFrame.formFrame.location.href='MyCode.aspx'
}
You could also just call the create_Map() script in the onload event for the
mapviewer frame but I found that this runs after everything in the
ViewerFrame had loaded.
Hopefully this helps
Brad Leighninger
Mathews & Associates, Inc
417-869-6009
BruceWeston wrote:
>
> Hello folks,
>
> I've been trying to create a 3-iframed web application in .NET, but I'm
> spending quite a bit of time trying to figure out when the AJAX viewer has
> been loaded in my code. I want to do this using my C# code behind instead
> of Javascript. Ideally, I'd like to use a call to a method which would
> return me a definite yes or no, then delay the loading of the iframes
> until the session is firmly established. Any ideas? Someone must have done
> something like this before......
>
> Thanks in advance!
>
>
>
--
View this message in context: http://www.nabble.com/Ajax-Viewer-and-iFrames-in-ASP.NET---has-anyone-perfected-this--tf4548874s16610.html#a13005036
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list