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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set selected item in dropdownlist within datagrid edit template

Status
Not open for further replies.

kalyankrishna

Programmer
Dec 6, 2002
3
IN
I have a datagrid with a template column.
The edit template is a dropdown list whose
datasource is set data reader.
How to set the selected index in this dd
to the item specified in the item template?
 
I always use the ItemDataBound event.

If MyGrid.EditItemIndex <> -1 And MyGrid.EditItemIndex = e.Item.ItemIndex Then
With CType(e.Item.Cells(3).FindControl(&quot;MyCbo&quot;), DropDownList)
.Items.FindByValue(MyValue).Selected = True
End With
End If

MyValue has the current item's value.
NetAngel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top