Editable DataGrid

A

alien2_51

In the EditCommand event I've added a drop down list to the controls
collection for the cell I want to edit.

Dim objDDLBrake As New DropDownList

objDDLBrake.CssClass = "label1"

objDDLBrake.Items.Add("A")

objDDLBrake.Items.Add("H")

objDDLBrake.SelectedIndex = -1

objDDLBrake.Items.FindByText(DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cell
s(6).Controls.Item(0), System.Web.UI.WebControls.TextBox).Text).Selected =
True

DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(6).Controls.Item(0),
System.Web.UI.WebControls.TextBox).Visible = False

WMIGrid.Items(e.Item.ItemIndex).Cells(6).Controls.Add(objDDLBrake)



So in my update event I try to access the newly created drop down list and
it's gone.... I have only one control in my controls collection, I expect
two...

Dim strFuelTypeCode As String =
DirectCast(WMIGrid.Items(e.Item.ItemIndex).Cells(7).Controls.Item(1),
System.Web.UI.WebControls.DropDownList).SelectedValue

Any thoughts 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

Top