I have an Ajax TabContainer. I also have a simple javascript function that normally can update a textbox using 'document.getElementById'
This works as expected when the textbox is outside the TabPanel but when I move the exact same textbox inside a TabPanel the Javascript function does not seem to be able to reference it.
The error reported is 'document.getElementById[..] is null or is not an object'
Any ideas
3 2851 gits 5,390
Expert Mod 4TB
hi ...
please post a link to a testpage or some code that is related to the problem ... so that we may have a closer look at it. how do you create tabs, panels, etc. ... we need more information to be able to help ...
kind regards
Here is some code: -
-
<head runat="server">
-
<title>Untitled Page</title>
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
-
<script type="text/javascript">
-
var map = null;
-
-
function GetMap()
-
{
-
var xpos = 59.33490764970564;
-
var ypos = 18.101434707641615;
-
var title = 'Radiohuset';
-
var note = 'Gärdets pärla';
-
var zoom = 10;
-
var typ = 'r';// r=road h=hybrid a=aerial(satellite)
-
var lock = false
-
-
map = new VEMap('myMap');
-
map.LoadMap(new VELatLong(xpos, ypos), zoom ,typ , lock);//--Kordinater,zoomlevel 19=närmast,karttyp,låst karta
-
//map.AttachEvent("onclick", onMapClick);
-
map.AttachEvent("onclick", MouseHandler);
-
map.AttachEvent("ondoubleclick", MouseHandler);
-
map.AttachEvent("onmousedown",MouseHandler);
-
map.AttachEvent("onmouseup",MouseHandler);
-
map.AttachEvent("onmousewheel",MouseHandler);
-
//map.AttachEvent("onmouseover",MouseHandler);
-
-
//Markera inte Radiohusets koordinater med nål utan centrera bara på den
-
//var pushpin = new VEPushpin('1',new VELatLong(xpos, ypos), null, title, note ); //Id - must be unique //latitude, longitude //icon url //Title //Notes
-
//map.AddPushpin(pushpin);
-
map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
-
map.ShowMiniMap(); // map.ShowMiniMap(100,200,VEMiniMap.Small);
-
map.ShowDisambiguationDialog(false);//-- visar inte stddialogen vid fler sökträffar
-
-
}
-
-
function MouseHandler(e)
-
{
-
if (e.eventName == "onclick")
-
{
-
if (e.leftMouseButton)
-
{
-
// var x = e.mapX;
-
// var y = e.mapY;
-
// pixel = new VEPixel(x, y);
-
// var LL = map.PixelToLatLong(pixel);
-
// map.SetCenter(LL);
-
// return false;
-
}
-
-
else if (e.rightMouseButton)
-
{
-
var x = e.mapX;
-
var y = e.mapY;
-
pixel = new VEPixel(x, y);
-
var LL = map.PixelToLatLong(pixel);
-
document.getElementById('Text1').value=LL;
-
}
-
else
-
{
-
alert('mclick');
-
}
-
}
-
else if (e.eventName == "ondoubleclick")
-
{
-
if (e.leftMouseButton)
-
{
-
}
-
else if (e.rightMouseButton)
-
{
-
}
-
else
-
{
-
}
-
}
-
else if (e.eventName == "onmouseover")
-
{
-
// check to see if we have hovered over a pushpin
-
// if(e.elementID=null)
-
// {
-
// var location = map.GetShapeByID(x.elementID).GetPoints()[0];
-
// alert('you hovered over latitude :' + location.Latitude
-
// + ' longitude :' + location.Longitude);
-
// }
-
-
// alert("cc");
-
}
-
}
-
-
</script>
-
</head>
-
-
<body style="background-color: #ffffcc" onload="GetMap();">
-
<form id="form1" runat="server">
-
<asp:ScriptManager ID="ScriptManager1" runat="server" />
-
-
<cc1:TabContainer ID="TabContainer1" runat="server" Height="400px" Width="791px" >
-
<cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Ärende" ToolTip="Här startar du ett nytt ärende">
-
<ContentTemplate>
-
<asp:TextBox ID="Text1" runat="server"></asp:TextBox>
-
-
-
</ContentTemplate>
-
</cc1:TabPanel>
-
<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Ärende-uppdatering" ToolTip="Här väljer du ett befintligt ärende att uppdatera">
-
<ContentTemplate>
-
</ContentTemplate>
-
</cc1:TabPanel>
-
<%--http://www.thescripts.com/forum/thread650780.html--%>
-
<cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="Karta" ToolTip="Här kan du positionera ditt ärende">
-
<ContentTemplate>
-
-
<div id='myMap' align="left" style="position:relative; height:100% ;width:100%"></div>
-
-
-
-
-
</ContentTemplate>
-
</cc1:TabPanel>
-
<cc1:TabPanel ID="TabPanel4" runat="server" HeaderText="Admin" ToolTip="Administrattionsgöromål du är behörig till">
-
<ContentTemplate>
-
</ContentTemplate>
-
</cc1:TabPanel>
-
</cc1:TabContainer>
-
<asp:TextBox ID="Text2" runat="server"></asp:TextBox>
-
-
</form>
-
</body>
-
-
When loading I get Javascript error 'exception thrown but not caught'
The map is however loaded but only parially visible. When I doubleclick it it expands to fill the TabPanel.
When I rightclick the map the Javascript error says 'document.getElementById('..') is null or not an object'
(If I change Text1 to the textbox Text2 it works OK)
Hope this makes the problem clearer.
Gunnar
gits 5,390
Expert Mod 4TB
hmmm ... may be the id of the textbox ('Text1') is replaced with something else when the page is loaded into the browser? have a look at the source-code when the page is loaded in IE ... and try to find the textbox ... and find out its id.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: podpi |
last post by:
Hello
I'm having a bit of a proooblem.
I have a gridview which has a checkbox as one of the templatecolumn's. When it is checked, it hides a textbox containing a DateTime templatefield...
|
by: JTok |
last post by:
I have an asp.net website I am designing using VS2005 standard. It is installed on Win2K3 Enterprise.
In a Wizard Control, I want to take user input from two textboxes, add them together, and then...
|
by: mackpag |
last post by:
i want to save the data which is written in textbox when i exit from the textbox that means when i lost the focus from textbox. the textbox is in the grid. so how to do that. the grid is in...
|
by: gsauns |
last post by:
I have a DetailsView inside a ModalPopup (using the AJAX
ModalPopupExtender).
I would like the user to have the ability to change the DetailsView's
mode within the ModalPopup.
But whenever I...
|
by: Wazzamatazz |
last post by:
Hi folks,
I've been trying to work out how to asynchronously update the contents
of a TabPanel using an UpdatePanel and I can't for the life of me get
it to work. I've seen a couple of examples...
|
by: =?Utf-8?B?TUNN?= |
last post by:
I have an asp.net page that contains an update panel. Within the update
panel, controls get added dynamically. During partial page post backs the
controls within the panel will change.
I have a...
|
by: dmj07 |
last post by:
What I would like to achieve is to have two divs on either side of my tab container, one on the left and one on the right both touching the far sides. Then information will need to go inbetween the...
|
by: navyjax2 |
last post by:
What if your event handler has to be nonstatic?
|
by: mherman284 |
last post by:
I've seen many posts to put inside div tag, or inside asp:panel. Neither works for IE7. Works in IE8. Note that this is inside CreateUserWizard ContentTemplate. Appears to be an MS bug.
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |