trouble deleting row in GridView

Discussion in 'ASP .Net' started by Jeff, Dec 31, 2008.

  1. Jeff

    Jeff Guest

    hi

    ..NET 3.5

    I have a GridView which I manually add rows to, by using this code:
    DataTable table;
    table = (DataTable)ViewState["table"];
    DataRow row = table.NewRow();
    row[0] = TextBox1.Text;
    table.Rows.Add(row);
    GridView1.DataSource = table;
    GridView1.DataBind();

    When I delete a row in the grid, then this event is fired. But it generate a
    StackOverFlow Exception, I'm not sure why...
    protected void GridView1_Deleting(object sender, GridViewDeleteEventArgs e)
    {
    GridView1.DeleteRow(e.RowIndex);
    }

    I've not yet specified DataKeyNames

    any suggestions?
     
    Jeff, Dec 31, 2008
    #1
    1. Advertisements

  2. Jeff

    comphilip Guest

    You have better give more error information. Past the error information
    given by asp.net
     
    comphilip, Jan 4, 2009
    #2
    1. Advertisements

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. H5N1
    Replies:
    0
    Views:
    2,994
  2. loga123
    Replies:
    2
    Views:
    5,950
    loga123
    Jun 28, 2006
  3. Replies:
    5
    Views:
    870
  4. Andy B
    Replies:
    0
    Views:
    1,244
    Andy B
    Apr 30, 2008
  5. Miguel Gómez
    Replies:
    3
    Views:
    1,458
    Miguel Gómez
    May 13, 2009
  6. D
    Replies:
    0
    Views:
    511
  7. Cas

    how to change labelvalue when deleting row in gridview?

    Cas, Jul 10, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    4
    Views:
    230
  8. Cas
    Replies:
    4
    Views:
    306
Loading...