Deleting rows in a datagrid

Discussion in 'ASP .Net Web Controls' started by Ridhi, Jan 2, 2004.

  1. Ridhi

    Ridhi Guest

    I have a datagrid wherein each row has a check box. the
    user has to select the rows which he wants to delte. After
    doing that and click "Delete" the user shpuld be prompted
    for "Delete yes? or no?" id yes is clicked go ahead and
    delete..or if no"Cancle the operation".Can anybody tell me
    how to do this.

    thanks in advance
    Ridhi, Jan 2, 2004
    #1
    1. Advertising

  2. Ridhi

    Alvin Bruney Guest

    Please examine the code provided, it achieves what you want.
    private void TrunkGroup_ItemCreated(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)

    {

    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
    ListItemType.AlternatingItem)

    {

    LinkButton deleteButton = ((LinkButton)e.Item.Cells[0].Controls[0]);

    deleteButton.Attributes.Add("onClick", "event.returnValue=confirm('Are you
    sure you wish to delete this item?');");

    }
    }
    --
    Regards,
    Alvin Bruney
    Got tidbits? Get it here...
    http://tinyurl.com/2bz4t
    "Ridhi" <> wrote in message
    news:01d601c3d175$08ba45f0$...
    > I have a datagrid wherein each row has a check box. the
    > user has to select the rows which he wants to delte. After
    > doing that and click "Delete" the user shpuld be prompted
    > for "Delete yes? or no?" id yes is clicked go ahead and
    > delete..or if no"Cancle the operation".Can anybody tell me
    > how to do this.
    >
    > thanks in advance
    Alvin Bruney, Jan 2, 2004
    #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. John
    Replies:
    3
    Views:
    678
    ocrow
    Jun 28, 2006
  2. Harry Barker
    Replies:
    2
    Views:
    507
    Alf P. Steinbach
    Apr 19, 2006
  3. Nazar
    Replies:
    0
    Views:
    433
    Nazar
    Aug 14, 2010
  4. Darren

    Deleting multiple rows (Hotmail style datagrid)

    Darren, Jan 21, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    141
    Darren
    Jan 21, 2005
  5. crea
    Replies:
    2
    Views:
    399
    Nobody
    Dec 28, 2012
Loading...

Share This Page