Re:how i make a window confirm to delete at datagrid?

Discussion in 'ASP .Net' started by Saravana, Oct 4, 2004.

  1. Saravana

    Saravana Guest

    Saravana, Oct 4, 2004
    #1
    1. Advertising

  2. it's complicate what you want to do but not imposible.
    so first you should put on your grid on item created event some code script
    on button which make the delete. Also on the delete icon you should put
    CommandName = "Delete".

    private void dg_ItemCreated(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if ((e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
    ListItemType.AlternatingItem) && e.Item.DataItem != null)
    {
    foreach(System.Web.UI.Control ctrl in e.Item.Controls)
    {
    foreach(Control ct in ctrl.Controls)
    {
    ImageButton b = ct as ImageButton;
    if (b != null && b.CommandName == "Delete" )
    b.Attributes.Add("onclick", "return confirm('Are you sure?');");
    }
    }
    }
    }


    Hope will work.

    "Saravana" wrote:

    >
    > Check out this article,
    > http://authors.aspalliance.com/aldotnet/examples/cd.aspx
    >
    > -Saravana
    > www.ExtremeExperts.com
    >
    > ____________________________________
    > Dexter Wrote:
    >
    > Hello all,
    >
    > I need to make a window confirm or a alert to confirm the exclusion of rows
    > of a datagrid.
    >
    > somebody know how i make this?
    >
    >
    > Thanks
    >
    >
    >
    > Dexter
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > Sent via SreeSharp NewsReader http://www.SreeSharp.com
    >
    =?Utf-8?B?UHN5Y2hv?=, Oct 4, 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. Calvin Lai
    Replies:
    4
    Views:
    7,943
    Calvin Lai
    Feb 4, 2004
  2. Dexter
    Replies:
    2
    Views:
    504
    Dexter
    Oct 3, 2004
  3. =?Utf-8?B?QXJuZQ==?=

    Confirm a delete in a Datagrid

    =?Utf-8?B?QXJuZQ==?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,378
    Steve C. Orr [MVP, MCSD]
    Apr 29, 2005
  4. =?iso-8859-1?B?UultaQ==?=
    Replies:
    7
    Views:
    2,499
    S. Justin Gengo
    Oct 26, 2005
  5. Amelyan

    Confirm Delete in DataGrid

    Amelyan, Apr 29, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    352
    Steve C. Orr [MVP, MCSD]
    Apr 30, 2005
Loading...

Share This Page