setting DropDownList.Index when editng a DataGrid?

Joined
Jan 22, 2003
Messages
22
Location
Indiana, USA
Hello!

I have some DropDownLists being populated by SQL calls when editing a DataGrid. How can I make a DropDown default to the value in the DataGrid? I know Im not explaining it well, but I think you get what I mean. If the cell in the DG says "Hi" how do I get the values coming into the DropDown default to "Hi"?

Thanks.
 
I assume you are populating your DataGrid from a DataSet.
Try the following.

DataGrid1.DataSource = DS1
Dim DropDownValue As String
DropDownValue = DS1.Tables(0).Rows(1).Item(7)

Obviously you will need to replace DropDownValue for whatever and add it to your Dropdown list.
 
I see what youre trying to do. But I have one question..

DropDownValue = DS1.Tables(0).Rows(1).Item(7)

The right side relates to the value(s) in the Grid? How can I get the row and item "coordinates" when edit is clicked? The DropDownLists can contain hundreds of items so I need to have each one default to the value in the Grid which is from the initial SQL Statement.

Many thanks!
 
Back
Top