Wednesday, March 28, 2012

Virtual Earth Connection/Event Problem When Nested In AJAX Control

Well, I was told today that I needed to make a web portal by the end of the month using .net technologies (my handle says it all) and I just hit my first roadblock.

In a condensed nutshell, I am trying to implement theVirtual Earth tool in an asp.net ajax tab control. When the VE <div> is located outside of the tab control then it works, but when I try to load it inside of the TabPanel it doesn't scroll properly and doesn't refresh.

I clipped out everything from my default.aspx except for the problem (below). Help is very much appreciated.

===================== SOURCE =================

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%> <!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <scriptsrc="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=4"></script> <scripttype="text/javascript">var map =null; function GetMap() { map =new VEMap('myMap'); map.LoadMap(); }</script> <htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"> <title>Map</title> <metahttp-equiv="Content-Type"content="text/html; charset=utf-8"></head><bodyonload="GetMap();"> <formid="form1"runat="server"> <ajaxToolkit:ToolkitScriptManagerID="ScriptManager1"runat="server"> <Scripts> <asp:ScriptReferencePath="Map.js"> </asp:ScriptReference> </Scripts> </ajaxToolkit:ToolkitScriptManager> <ajaxToolkit:TabContainerID="TabContainer1"runat="server"ActiveTabIndex="0"ScrollBars="Auto"> <ajaxToolkit:TabPanelID="TabPanel1"runat="server"HeaderText="Map Tab"> <ContentTemplate> <divid='myMap'style="position: relative; width: 400px; height: 400px;"/> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </form></body>

</html>

===================== END SOURCE =================

I had the same problems working with TabContainer Control and Virtual Earth Control .

A workournd I have found that partially solves this issue is to remove the code

ActiveTabIndex="0"

from the definition of the TabContainer control.

You may find more info on this on this URL :

http://www.dotnetside.org/blogs/lucab/archive/2007/10/05/Mappe-di-Virtual-Earth-e-controllo-Tabs-di-AJAX-Control-Toolkit.aspx

George

No comments:

Post a Comment