473,396 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Updating textbox inside a TabPanels ContentTemplate

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
Oct 12 '07 #1
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
Oct 12 '07 #2
Here is some code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <head runat="server">
  3.     <title>Untitled Page</title>
  4.      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5.      <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
  6.       <script type="text/javascript">
  7.          var map = null; 
  8.  
  9.          function GetMap()
  10.          {
  11.            var xpos = 59.33490764970564;
  12.            var ypos = 18.101434707641615;
  13.            var title = 'Radiohuset';
  14.            var note = 'Gärdets pärla';
  15.            var zoom =  10;
  16.            var typ =  'r';// r=road h=hybrid a=aerial(satellite)
  17.            var lock = false
  18.  
  19.             map = new VEMap('myMap');  
  20.              map.LoadMap(new VELatLong(xpos, ypos), zoom ,typ , lock);//--Kordinater,zoomlevel 19=närmast,karttyp,låst karta
  21.              //map.AttachEvent("onclick", onMapClick);
  22.              map.AttachEvent("onclick", MouseHandler);
  23.              map.AttachEvent("ondoubleclick", MouseHandler);
  24.              map.AttachEvent("onmousedown",MouseHandler);
  25.              map.AttachEvent("onmouseup",MouseHandler);
  26.              map.AttachEvent("onmousewheel",MouseHandler);
  27.              //map.AttachEvent("onmouseover",MouseHandler);
  28.  
  29. //Markera inte Radiohusets koordinater med nål utan centrera bara på den
  30.            //var pushpin = new VEPushpin('1',new VELatLong(xpos, ypos), null, title, note  ); //Id - must be unique  //latitude, longitude //icon url  //Title  //Notes
  31.              //map.AddPushpin(pushpin);
  32.              map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
  33.              map.ShowMiniMap(); // map.ShowMiniMap(100,200,VEMiniMap.Small);
  34.              map.ShowDisambiguationDialog(false);//-- visar inte stddialogen vid fler sökträffar
  35.  
  36.   } 
  37.  
  38.     function MouseHandler(e)
  39. {
  40.    if (e.eventName == "onclick")
  41.   {
  42.     if (e.leftMouseButton)
  43.     {
  44. //    var x = e.mapX;
  45. //    var y = e.mapY;
  46. //    pixel = new VEPixel(x, y);
  47. //    var LL = map.PixelToLatLong(pixel);
  48. //    map.SetCenter(LL);
  49. //    return false;
  50.      }
  51.  
  52.     else if (e.rightMouseButton)
  53.      {
  54.          var x = e.mapX;
  55.          var y = e.mapY;
  56.          pixel = new VEPixel(x, y);
  57.          var LL = map.PixelToLatLong(pixel);
  58.            document.getElementById('Text1').value=LL;
  59.       }
  60.     else
  61.     {
  62.     alert('mclick');
  63.      }
  64. }
  65.   else if (e.eventName == "ondoubleclick")
  66.   {
  67.     if (e.leftMouseButton)
  68.     {
  69.      }
  70.     else if (e.rightMouseButton)
  71.      {
  72.      }
  73.     else
  74.      {
  75.      }
  76.   }
  77.  else if (e.eventName == "onmouseover") 
  78.  {
  79.  // check to see if we have hovered over a pushpin
  80. //   if(e.elementID=null)
  81. //   {
  82. //     var location = map.GetShapeByID(x.elementID).GetPoints()[0];
  83. //    alert('you hovered over latitude :' + location.Latitude 
  84. //       + ' longitude :' + location.Longitude);  
  85. //     }
  86.  
  87. // alert("cc");
  88.  }
  89. }
  90.  
  91.       </script>
  92. </head>
  93.  
  94. <body style="background-color: #ffffcc" onload="GetMap();">
  95.      <form id="form1" runat="server">
  96.         <asp:ScriptManager ID="ScriptManager1" runat="server" />
  97.  
  98.             <cc1:TabContainer ID="TabContainer1" runat="server" Height="400px" Width="791px" >
  99.                 <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Ärende" ToolTip="Här startar du ett nytt ärende">
  100.                <ContentTemplate>
  101.                <asp:TextBox ID="Text1" runat="server"></asp:TextBox>
  102.  
  103.  
  104.                </ContentTemplate>
  105.                 </cc1:TabPanel>
  106.                 <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Ärende-uppdatering" ToolTip="Här väljer du ett befintligt ärende att uppdatera">
  107.                 <ContentTemplate>
  108.                                  </ContentTemplate>
  109.                 </cc1:TabPanel>
  110.                 <%--http://www.thescripts.com/forum/thread650780.html--%>
  111.                 <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="Karta" ToolTip="Här kan du positionera ditt ärende">
  112.                 <ContentTemplate>
  113.  
  114.                   <div   id='myMap'  align="left" style="position:relative; height:100% ;width:100%"></div> 
  115.  
  116.  
  117.  
  118.  
  119.                     </ContentTemplate>
  120.                 </cc1:TabPanel>
  121.             <cc1:TabPanel ID="TabPanel4" runat="server" HeaderText="Admin" ToolTip="Administrattionsgöromål du är behörig till">
  122.                 <ContentTemplate>
  123.                 </ContentTemplate>
  124.                 </cc1:TabPanel>
  125.             </cc1:TabContainer>
  126.          <asp:TextBox ID="Text2" runat="server"></asp:TextBox>
  127.  
  128.     </form>
  129. </body>
  130.  
  131.  
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
Oct 16 '07 #3
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.
Oct 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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...
1
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...
0
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...
1
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...
1
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...
2
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...
2
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...
18
by: navyjax2 | last post by:
What if your event handler has to be nonstatic?
2
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. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
1
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...
0
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...
0
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...
0
Oralloy
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,...
0
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.