473,509 Members | 2,863 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 955

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

Similar topics

1
1765
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
2568
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...
0
2057
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...
0
1281
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...
2
3612
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...
6
10655
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. ...
3
1567
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,...
2
4534
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...
4
2710
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...
3
2779
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...
0
7237
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,...
0
7347
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
7416
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...
1
7073
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
7506
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...
0
4732
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...
0
3218
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...
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
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...

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.