Want to add row under selected row of gridview

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

  1. 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
    ------------------------------------------------
    This is the details section of
    The above row.
    ------------------------------------------------
    select bla2 bla22 bla32


    See?
    , Feb 16, 2007
    #1
    1. Advertising

  2. 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
    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?
    , Feb 16, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3VyZXNo?=
    Replies:
    1
    Views:
    447
    Saravana
    Nov 22, 2004
  2. ABC
    Replies:
    1
    Views:
    934
    Patirck Ige
    Oct 7, 2005
  3. Bob
    Replies:
    3
    Views:
    1,516
  4. Jason
    Replies:
    1
    Views:
    2,282
    Alexey Smirnov
    Dec 14, 2009
  5. Selected Row Only GridView Row Visible?

    , Oct 17, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    276
Loading...

Share This Page