469,917 Members | 1,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Help with adding extra Row to Datagrid...

I posted this in the datagrid forum but got no bites, so I thought I'd
post it here as well for some help....
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/art...80702-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.Sel ectedIndex + 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!
Jul 21 '05 #1
0 2503

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Abhas | last post: by
28 posts views Thread by stu_gots | last post: by
3 posts views Thread by Jim Heavey | last post: by
6 posts views Thread by Bart Schelkens | last post: by
3 posts views Thread by serge calderara | last post: by
2 posts views Thread by Terry Olsen | last post: by
1 post views Thread by Geraldine Hobley | last post: by
reply views Thread by Brian Greiwe | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.