Delete record

C

CreativeMind

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.

}

}
 
A

Arnab das

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();
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top