Want to add row under selected row of gridview

Discussion in 'ASP .Net Building Controls' started by ujjc001, Feb 16, 2007.

  1. ujjc001

    ujjc001 Guest

    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
    ujjc001, Feb 16, 2007
    1. Advertisements

  2. ujjc001

    ujjc001 Guest

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

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

    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?
    ujjc001, Feb 16, 2007
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.