Can't get to nested dropdown in edititemtemplate column

B

Brian Greiwe

I've created a datagrid with 1 edititemtemplate column. When the user
clicks edit, it spans the entire width of the datagrid (removing the
other cells). This column has several controls in it (text boxes,
radiobuttons, and a dropdownlist). Also, on the itemdatabound, I am
adding another row to the datagrid (above the edititemtemplate) to act
as a "header" row, which shows the row being editted in its original
state.

Make sense so far?

Ok, all my data gets bound to my controls correctly, no problem.
However, when I click update, 1 control fails - that's the dropdown.
It still exists, but it is has no datasource, no items, etc...they've
been lost. I was setting my dropdown datasource using the same method
as shown at http://aspnet.4guysfromrolla.com/articles/080702-1.2.aspx
and also tried the approach at
http://www.4guysfromrolla.com/webtech/050801-1.shtml. Again, they
both work to create the dropdown, but I lose it on the updatecommand.

Now, if I move my "header" row to be below the item being editted,
everything is happy and still works. However, visually, that doesn't
make sense to the user.

Any way to get it to work with the added header row? I'm using:

For m = 0 To DataGrid1.Columns.Count - 1
mycell = New TableCell
mycolumnname = DataGrid1.Columns(m).HeaderText
If Not mycolumnname.Equals(String.Empty) Then
mycell.Text = dt.Select("ID = " &
viewstate("myrowid"))(0).Item(DataGrid1.Columns(m).HeaderText)
End If
mycell.ApplyStyle(DataGrid1.SelectedItemStyle)
dgitem.Cells.Add(mycell)
Next
If DataGrid1.SelectedIndex > -1 Then
DataGrid1.Controls(0).Controls.AddAt(DataGrid1.SelectedIndex + 2,
dgitem)
End If

to create my header row. It looks nice, but that darned dropdownlist
just isn't working.

Any help would be greatly appreciated!
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top