473,324 Members | 2,268 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,324 software developers and data experts.

problem is displaying values in html select control

375 256MB
Hi,

I have two controls one html select control and one asp.net dropdownlist control.

In html select control i have three maps loaded. It is loaded in the following manner.
Expand|Select|Wrap|Line Numbers
  1. <SELECT class="TextBoxLabel" id="ddlMap" style="WIDTH: 128px;" tabIndex="1" onchange="fnChangeMap();"
  2.  
  3. name="ddlMap" runat="server">
  4.  
  5.  
  6. </SELECT>
  7.  
  8.  
  9.  
  10. function fnChangeMap()
  11.  
  12.  
  13. if(document.frmLiveTrack.ddlMap.value != 0){
  14.  
  15. var vMap = document.frmLiveTrack.ddlMap.value;
  16.  
  17. var vMapValues = vMap.split(",");
  18.  
  19. for(i=0 ; i < vMapValues.length ; i=i+5)
  20.  
  21. {
  22.  
  23. document.mapping.country.value = vMapValues[i];
  24.  
  25. document.frmLiveTrack.country.value = vMapValues[i];
  26.  
  27. document.frmLiveTrack.country1.value = vMapValues[i];
  28.  
  29. document.mapping.Lat.value = vMapValues[i+1];
  30.  
  31. document.mapping.Lon.value = vMapValues[i+2];
  32.  
  33. document.mapping.scale.value = vMapValues[i+3];
  34.  
  35. document.frmLiveTrack.DefaultURL.value = vMapValues[i+4];
  36.  
  37. }
  38.  
  39. //alert(document.frmLiveTrack.DefaultURL.value);
  40.  
  41. document.mapping.target = "MainFrame";
  42.  
  43. document.mapping.method = "get";
  44.  
  45. document.mapping.action = document.frmLiveTrack.DefaultURL.value; 
  46.  
  47. document.mapping.submit(); 
  48.  
  49. }
  50.  
  51. else{
  52.  
  53. alert("Select a Map");
  54.  
  55. }
  56.  
  57. }
  58.  
  59.  
  60.  
  61. Further i have a function called as load map which is called in page load event
  62.  
  63. private void LoadMap(string strUserId, int iUserType)
  64.  
  65. {
  66.  
  67. this.loadmapval = "Dhanus";
  68.  
  69. string text1 = "";
  70.  
  71. DataSet set1 = new DataSet();
  72.  
  73. ConnectionCls cls1 = new ConnectionCls();
  74.  
  75. text1 = TrackQuery.getMapQry(strUserId, iUserType);
  76.  
  77. set1 = cls1.dsGetValues(text1);
  78.  
  79. string text2 = base.Request.Params["country"];
  80.  
  81. if (iUserType == 1)
  82.  
  83. {
  84.  
  85. this.ddlMap.Visible = true;
  86.  
  87. this.lblCountry.Visible = false;
  88.  
  89. if (set1.Tables[0].Rows.Count > 0)
  90.  
  91. {
  92.  
  93. for (int num1 = 0; num1 < set1.Tables[0].Rows.Count; num1++)
  94.  
  95. {
  96.  
  97. DataRow row1 = set1.Tables[0].Rows[num1];
  98.  
  99. string text3 = Convert.ToString(row1["MAPNAME"]);
  100.  
  101. text3 = text3 + "," + Convert.ToString(row1["MAPLAT"]);
  102.  
  103. text3 = text3 + "," + Convert.ToString(row1["MAPLONG"]);
  104.  
  105. text3 = text3 + "," + Convert.ToString(row1["MAPSCALE"]);
  106.  
  107. string text7 = text3;
  108.  
  109. text3 = text7 + "," + Convert.ToString(row1["MAP_URL"]) + "/" + Convert.ToString(row1["ENGINE_DEFAULT_URL"]);
  110.  
  111. if (text2.Equals(Convert.ToString(row1["MAPNAME"])))
  112.  
  113. {
  114.  
  115. this.strMapDetail = text3;
  116.  
  117. }
  118.  
  119. this.ddlMap.Items.Add(new ListItem(row1["MAPNAME"].ToString(), text3));
  120.  
  121. }
  122.  
  123. }
  124.  
  125. }
  126.  
  127. else if (iUserType == 2)
  128.  
  129. {
  130.  
  131. this.ddlMap.Visible = true;
  132.  
  133. this.lblCountry.Visible = false;
  134.  
  135. if (set1.Tables[0].Rows.Count > 0)
  136.  
  137. {
  138.  
  139. for (int num2 = 0; num2 < set1.Tables[0].Rows.Count; num2++)
  140.  
  141. {
  142.  
  143. DataRow row2 = set1.Tables[0].Rows[num2];
  144.  
  145. string text4 = Convert.ToString(row2["MAPNAME"]);
  146.  
  147. text4 = text4 + "," + Convert.ToString(row2["MAPLAT"]);
  148.  
  149. text4 = text4 + "," + Convert.ToString(row2["MAPLONG"]);
  150.  
  151. text4 = text4 + "," + Convert.ToString(row2["MAPSCALE"]);
  152.  
  153. string text8 = text4;
  154.  
  155. text4 = text8 + "," + Convert.ToString(row2["MAP_URL"]) + "/" + Convert.ToString(row2["ENGINE_DEFAULT_URL"]);
  156.  
  157. if (text2.ToUpper().Equals(Convert.ToString(row2["MAPNAME"]).ToUpper()))
  158.  
  159. {
  160.  
  161. this.strMapDetail = text4;
  162.  
  163. }
  164.  
  165. this.ddlMap.Items.Add(new ListItem(row2["MAPNAME"].ToString(), text4));
  166.  
  167. }
  168.  
  169. }
  170.  
  171. }
  172.  
  173. else
  174.  
  175. {
  176.  
  177. this.ddlMap.Visible = true;
  178.  
  179. this.lblCountry.Visible = false;
  180.  
  181. if (set1.Tables[0].Rows.Count > 0)
  182.  
  183. {
  184.  
  185.  
  186. if (set1.Tables[0].Rows.Count > 0)
  187.  
  188. {
  189.  
  190. for (int num3 = 0; num3 < set1.Tables[0].Rows.Count; num3++)
  191.  
  192. {
  193.  
  194. DataRow row3 = set1.Tables[0].Rows[num3];
  195.  
  196. string text5 = Convert.ToString(row3["MAPNAME"]);
  197.  
  198. text5 = text5 + "," + Convert.ToString(row3["MAPLAT"]);
  199.  
  200. text5 = text5 + "," + Convert.ToString(row3["MAPLONG"]);
  201.  
  202. text5 = text5 + "," + Convert.ToString(row3["MAPSCALE"]);
  203.  
  204. string text9 = text5;
  205.  
  206. text5 = text9 + "," + Convert.ToString(row3["MAP_URL"]) + "/" + Convert.ToString(row3["ENGINE_DEFAULT_URL"]);
  207.  
  208. if (text2.Equals(Convert.ToString(row3["MAPNAME"])))
  209.  
  210. {
  211.  
  212. this.strMapDetail = text5;
  213.  
  214. }
  215.  
  216. this.ddlMap.Items.Add(new ListItem(row3["MAPNAME"].ToString(), text5));
  217.  
  218. }
  219.  
  220. }
  221.  
  222. }
  223.  
  224. else
  225.  
  226. {
  227.  
  228.  
  229. StringBuilder builder1 = new StringBuilder();
  230.  
  231. builder1.Append("SELECT MAPNAME FROM MAP_SUPERUSER ");
  232.  
  233. builder1.Append(" WHERE ");
  234.  
  235. builder1.Append(" SUPERUSERID = (SELECT SUPERUSERID ");
  236.  
  237. builder1.Append(" FROM USERS WHERE USERID='" + strUserId + "')");
  238.  
  239. builder1.Append(" AND DEFAULT_MAP ='1'");
  240.  
  241. string text6 = (string)cls1.ExecuteScalar(builder1.ToString());
  242.  
  243. this.lblCountry.Text = text6;
  244.  
  245. this.strCountry = text6;
  246.  
  247. }
  248.  
  249. this.ViewState["COUNTRY"] = this.strCountry;
  250.  
  251. }
  252.  
  253. }
Now to my problem, when I choose any values from the dropdownlist1, the values in the html select control called ddlmap gets vanished.

eg. if there are three values 1,2,3 by default the value 1 is displayed on the select control and the values 2,3 are in the dropdown area whereas when i choose the value from dropdownlist(server control) nothing is displayed. The select control is empty and all the values 1,2,3 are in dropdown area.



i tried giving ddlmap.SelectedIndex = 1;

but to no avail.





Kindly help please



Regards

cmrhema
Mar 12 '08 #1
0 1480

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

Similar topics

5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
0
by: nate | last post by:
the error returned is this: Server Error in '/AnnAccRpt' Application. -------------------------------------------------------------------------------- Could not find control 'DropDownList1' in...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
11
by: kavithadevan | last post by:
Hi, Here i pasted Three scripts first one is displaying the details which i have stored in database this is working but in second script is in link with first one if i click main.php it...
0
by: paragguptaiiita | last post by:
I have one problem regarding displaying text from XML file. I have a XSL variable named $p = (0 0 0) (0.82 0 0) (1.63 -0.01 0) (2.63 -0.01 0) (3.63 -0.01 0) (4.63 -0.01 0) (5.63 -0.02 0) (6.63 -0.02...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
2
coolv
by: coolv | last post by:
Hello I have problem in my page that the dropdown box is not displaying data according to selection of first dropdown.Please help me. Below is my code. thanks.............. <?php ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.