Want to add row under selected row of gridview

U

ujjc001

I used to know how to hijack the last cell of a datagrid when it's
selected but can't seem to with a gridview. It's been a while, but I
seem to remember adding something like this "</td></tr><tr><td
colspan=4>testinghere</td></tr>" to get another row that I could
edit. I don't know what's best here but all I want it a big empty
row / only 1 column, when I select my gridview row.
| colx | coly | colz |
select(ed) bla bla2 bla3
 
U

ujjc001

so, this is where I am at now...

Private Sub GridView1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
GridView1.DataBind()
Dim ntr As New GridViewRow(GridView1.SelectedIndex + 1, -1,
DataControlRowType.DataRow, DataControlRowState.Normal)
Dim ntc As New TableCell
ntr.Cells.Add(ntc)
ntc.ColumnSpan = 4
ntc.Text = "this is the long cell"
Dim fv1 As New FormView
fv1 = FormView1
fv1.Visible = True
ntc.Controls.Add(fv1)

GridView1.SelectedRow.Parent.Controls.AddAt(GridView1.SelectedIndex +
2, ntr)
End Sub

not pretty- but I'm just testing- I get the viewstate error, since
this control is dynamically created... any thoughts?
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top