Delete record

Discussion in 'ASP .Net' started by CreativeMind, Mar 31, 2008.

  1. CreativeMind

    CreativeMind Guest

    hi all,
    private void dgMygrid_ItemCreated(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)
    {

    Button bDelete=(Button)e.Item.FindControl("btnDelete");
    if(bDelete!=null)
    {
    bDelete.Attributes.Add("OnClick","javascript:return confirm('Are
    you sure you want to delete this sales person?');");
    // if user clicks ok, then i want to call deleteRecord(); Question is
    how i trace 'ok'?
    ie. // if ok then delete record else do nothing.

    }

    }
    CreativeMind, Mar 31, 2008
    #1
    1. Advertising

  2. CreativeMind

    Arnab das Guest

    On Mar 31, 9:45 pm, CreativeMind <> wrote:
    > hi all,
    > private void dgMygrid_ItemCreated(object sender,
    > System.Web.UI.WebControls.DataGridItemEventArgs e)
    >                 {
    >
    >                         Button bDelete=(Button)e..Item.FindControl("btnDelete");
    >                         if(bDelete!=null)
    >                         {
    >                                 bDelete.Attributes.Add("OnClick","javascript:return confirm('Are
    > you sure you want to delete this sales person?');");
    > // if user clicks ok, then i want to call deleteRecord(); Question is
    > how i trace 'ok'?
    > ie. // if ok then delete record else do nothing.
    >
    >                         }
    >
    >                 }


    call a javascript function form onclinetclick for the "btnDelete"
    button.
    Inside the function write the following code
    function confirm()
    {
    var returnvalue = window.confirm('Are you sure you want to delete
    this sales person?');");
    return returnvalue ;
    }

    in code behind write
    private void dgMygrid_ItemCreated(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)
    {

    Button
    bDelete=(Button)e.Item.FindControl("btnDelete");
    //delete function();
    }
    Arnab das, Apr 1, 2008
    #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?SnVzdGlu?=

    Retrieving Record Key while creating the record.

    =?Utf-8?B?SnVzdGlu?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    623
    =?Utf-8?B?SnVzdGlu?=
    Oct 5, 2004
  2. André
    Replies:
    0
    Views:
    3,730
    André
    Jun 25, 2006
  3. MRW
    Replies:
    0
    Views:
    366
  4. THurkmans
    Replies:
    2
    Views:
    591
  5. Frits van Soldt

    How to insert a new record in detailsview when there are no record

    Frits van Soldt, Nov 16, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    724
    Frits van Soldt
    Nov 17, 2005
Loading...

Share This Page