473,666 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with dropdown lists in Form

1 New Member
Hi Friends,

I have 2 Forms one is ListMenu.aspx and other one is ModifyMenu.aspx .

Listmenu.aspx is to diaply all the menus of Tree View Control in Data Grid.

like First Column is TabName, Second Column is Menu Name and Thid cloumn is Edit in DatGrid.


when i click on Edit its redirected to ModifyMenu.aspx Form using QueryStirng
(tb001_id is passing as querystring)

In ModiyMenu.aspx there are 3 drop down lists are there for

TabName
Child Level
Menu Parent

Now my problem is how to assign the corresponding values from database into these ddl's when i click on edit in datagrid in ListMenu.aspx Form

My code is like this:

Expand|Select|Wrap|Line Numbers
  1. private void bindDataFields(Int32 tb001_id)
  2.     {
  3.         string errorMsg = "";
  4.         DataTable dt = objForm_MTreeBLL.bindFields(tb001_id, ref errorMsg);
  5.         if (errorMsg == "")
  6.         {
  7.             //ddlTabName.SelectedItem.Text = dt.Rows[0]["ptab"].ToString();
  8.             for (int i = 0; i < ddlTabName.Items.Count; i++)
  9.             {
  10.                 if (ddlTabName.Items[i].Text = dt.Rows[0]["ptab"])
  11.                 {
  12.                     ddlTabName.SelectedIndex = Items.Values;
  13.                 }
  14.                 else 
  15.                 {
  16.                     ddlTabName.SelectedIndex = 0;
  17.                 }
  18.             }
  19.  
  20.             txtMenuName.Text = dt.Rows[0]["menu_name"].ToString();
  21.             txtMenuLink.Text = dt.Rows[0]["menu_link"].ToString();
  22.             //ddlConpgid.SelectedItem.Value = Convert.ToString(dt.Rows[0]["conpg_id"]);
  23.             //ddlChildLvl.SelectedItem.Value = Convert.ToString(dt.Rows[0]["child_lvl"]);
  24.             //ddlMenuPrnt.SelectedItem.Value = Convert.ToString(dt.Rows[0]["menu_prnt"]);
  25.             chkMenuActive.Checked = Convert.ToBoolean(dt.Rows[0]["menu_activ"]);
  26.             txtMenuTooltip.Text = dt.Rows[0]["menu_tip"].ToString();
  27.             txtMenuSummary.Text = dt.Rows[0]["menu_sum"].ToString();
  28.         }
  29.         else
  30.         {
  31.             lblMsg.Text = "Error : " + errorMsg;
  32.         }
  33.     }
  34.  
  35.  
i get data into text boxes. not getting data into ddl's

is this code is correct:
Expand|Select|Wrap|Line Numbers
  1.  
  2.  for (int i = 0; i < ddlTabName.Items.Count; i++)
  3.             {
  4.                 if (ddlTabName.Items[i].Text = dt.Rows[0]["ptab"])
  5.                 {
  6.                     ddlTabName.SelectedIndex = Items.Values;
  7.                 }
  8.                 else 
  9.                 {
  10.                     ddlTabName.SelectedIndex = 0;
  11.                 }
  12.             }
  13.  
  14.  
Can you please let me know how to solve this problem

Thanks in advance.

Regards,
Hari
Aug 22 '07 #1
0 967

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

Similar topics

1
1773
by: Ralph Freshour | last post by:
I have two dropdown list: frm_cbo_top frm_cbo_bottom I have an OnChange="submit_form();" in each of these dropdown lists - the javascript does a form.submit() call
0
2589
by: Toonman | last post by:
I have a webpage with a <form> consisting of a large table grid of dropdown lists used to make changes in a database. Some of these dropdown lists have the same value. I'm trying to make it so that when a user mouses over one of the dropdown lists, that dropdown list, and all other dropdown lists having that same value are highlighted with a yellow background color. Then on a mouseout the yellow highlights go away. The goal is to it...
0
2067
by: Mike O. | last post by:
MS Access 2003 "filter by form" has drop down lists that allow the user to select values for each field to filter by. However, once some values are selected,the remaining dropdown lists remain the same and aren't progressively filtered to reflect the selections already made in other fields. This can be very tedious when filtering a large datasheet. Unlike Access, the MS Excel autofilter has automatic progressive filtering of value...
0
1293
by: E . | last post by:
I seem to be getting nowhere with this problem here is the situation. I have a webform with a data grid populated with the results of a table that has only 3 fields. Then below that are 1 dropdown list, a text field, and another dropdown list and a button that represents and add routine to put data into the table. The dropdownlists are populated on the onload event of the controls, they are working fine. Also adding records is...
2
3620
by: Chris Becker | last post by:
This is my attempt to rephrase a question I asked earlier that got no response. I suspect it was my poor/unplanned wording. Here is another attempt: I have a form with some drop down lists. I would like the user to be able to start filling in the form, then get to one of the dropdown lists (ex: Service Type) and realize that the dropdown list does not contain the entry that they need. So next to the Service Type drop down list is a...
6
10681
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. Let's say you select 1 of the items, and are properly redirected. You press the back button. I have three servers providing two different functionalities: 1. After pressing the back button, the item you selected in the dropdown is still selected.
3
1573
by: Jon | last post by:
I am using cascading dropdowns, where the selection in one determines what fills another. In regular ASP I simply loaded a giant dataset into javascript array and when you clicked on one dropdown, it populated the others accordingly. In ASP.Net, I was looking for a way to do this without javascript. So, I made my form and put code in the SelectedIndexChanged event of the dropdown that populates the next dropdown. Of course to do this,...
2
4545
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am doing the following:
4
2719
by: Paul | last post by:
Hi all, I have a page that has a form on it which has a dropdown list on it. It connect to an sql database and populate the list. What I would like to do is make the list editable so that if the data returned doesnt contain what I want, I can type in the data I require which will then be updated to the database when the form is posted. Hope I've made sense, you may be able to tell I'm a bit of a newbie!
3
2784
by: John | last post by:
I have two dropdown lists that I have bound to a datatable and set the DataTextField and DataValueField for. Both lists show the values I expect from the database. However, when I need to access the valueField for a dropdown list I always get the first value. Here is my code I do on load to bind the dropdowns: Try 'load the Division Dropdown dtDiv = objDAL.ExecuteDataTable("GetDivision") With ddDivision
0
8445
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.