DropDownList in Datagrid

E

Evan Camilleri

I managed to do a DropDownList in Datagrid on Edit (normally, the templates
puts a label). My problem is that I cannot initialize it when I do the
edit.

I am doing the following

' Select the current row for 'edit mode'
dg.EditItemIndex = e.Item.ItemIndex
BindDataGrid()

' Select default dropdown option, as earlier
Dim ddl As DropDownList
ddl = CType(dg.Items(dg.EditItemIndex).FindControl("ddlJobType"),
DropDownList)
Parent.BindDataReader("tb_JobTypes", "jtp", ddl) '>>> binds the
dropdownlist to the table

ddl.SelectedIndex =
ddl.Items.IndexOf(ddl.Items.FindByValue(e.Item.Cells(2).Text)) '>>>> NOT
WORKING

What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top