473,471 Members | 4,650 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select DropDownList Text Dynamically

For an Edit User section of my application I have created a DataReader
that sets textbox.text values = objDataReader("field"). One of the
fields in the table is Department and to display this I have chosen to
use a dropdownlist. I have tried setting:

ddlDepartment.SelectedItem.Text = objDataReader("Department")

The departments are:

Administration - Value 1
Finance - Value 2
Engineering - Value 3

When I use the method above It simply replaced Administration with
whatever the user is saved as but the value still stays the same.

I know this sounds confusing but if needed I can elaborate.

- Will

---
"Our enemies are innovative and resourceful, and so are we. They never
stop thinking of ways to harm our country and our people, and neither do
we." President George W. Bush

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
2 1162
You would need to do something like this:

string sValue = objDataReader("Department");
ddlDepartment.SelectedValue = sValue;

"Will Chamberlain" <wi**************@devdex.com> wrote in message
news:ez*************@TK2MSFTNGP11.phx.gbl...
For an Edit User section of my application I have created a DataReader
that sets textbox.text values = objDataReader("field"). One of the
fields in the table is Department and to display this I have chosen to
use a dropdownlist. I have tried setting:

ddlDepartment.SelectedItem.Text = objDataReader("Department")

The departments are:

Administration - Value 1
Finance - Value 2
Engineering - Value 3

When I use the method above It simply replaced Administration with
whatever the user is saved as but the value still stays the same.

I know this sounds confusing but if needed I can elaborate.

- Will

---
"Our enemies are innovative and resourceful, and so are we. They never
stop thinking of ways to harm our country and our people, and neither do
we." President George W. Bush

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #2
Thanks a ton Raul!

---
"Our enemies are innovative and resourceful, and so are we. They never
stop thinking of ways to harm our country and our people, and neither do
we." President George W. Bush

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
0
by: Stephan Bour | last post by:
I need to implement a simple search function to lookup order information in a SQLserver table. The code below works fine for a search to the łOrderID˛ column. However, Iąd like to offer the user...
2
by: Shiju Poyilil | last post by:
Hi ! I have a requirement wherein i am binding a datalist which contains a label (Caption for the field) and some literal hidden fields and a dropdown list. When I am binding to the datalist.....
8
by: utterberg | last post by:
Hi I'm adding two dropdownlist in my webform by clicking a button. I fill the first dropdown with some values from my DB and the other one when I choose from the first dropdown. But since theese...
1
by: Kevin Blount | last post by:
I have a test script right now that I'm fighting with. The idea is to "simply" have an aspx page with 3 panels, to show 3 "different" forms and then a 4th panel to show the results of processing...
2
by: Kevin Blount | last post by:
I have a test script right now that I'm fighting with. The idea is to "simply" have an aspx page with 3 panels, to show 3 "different" forms and then a 4th panel to show the results of processing...
4
by: =?Utf-8?B?c2lMdmVy?= | last post by:
Hhi, I'm working on an asp .net project that have small side panel which 'disallow' long SELECT/dropdown list.. So i could not force them to a certain that shows my longest option, which now...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
0
by: Moneypenny | last post by:
Hi there, I have a Gridview control which has a dropdownlist in every row. The dropdowns are populated dynamically from a database (so the content is different in each row. There is also a select...
3
by: ata | last post by:
Hi folks, Consider the following code: protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; if (row.RowType != DataControlRowType.DataRow)...
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
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
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
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...
0
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,...
0
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
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.