Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdownlist to populate another field in Datagrid

Status
Not open for further replies.

bubberz

Programmer
Dec 23, 2004
117
US
I have the dropdown list that has three fields in it's select statement:
1. The concat of two fields,Res & Desc as "Expr1", which is what the dropdown displays
2. The value field of "Res" which is the Primary Key
3. The field "Desc" which is what I want to populate another cell with

I'm trying to figure out a way to get another cell in the same row to populate with the Description

Thanks!
 
when you load the drop down list set the value of the item to that records primary key.

foreach(DataRow dr in myDataSet.Tables[0])
{
ddl_myList.Items.Add(new System.Web.UI.WebControls.ListItem(dr["Expr1"].ToString(),dr["Res"].ToString()));
}

set the attribute AutoPostBack=true in the aspx page for the dropdownlist

add an event to acure whenever the selected index changes and you can run a new query to get the description for the DropDownList.SelectedItem.Value
 
What do you mean by another cell? What exactly are you trying to do?
 
Let's say there are five cells/columns in a row.
The first has a dropdown list with two fields, "resource" and "description", as "Expr1". The third contains a "description" column. What I want is this third column to be udpated with the Description that matches what the user selected from the dropdown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top