Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Delete record (http://www.velocityreviews.com/forums/t603215-delete-record.html)

CreativeMind 03-31-2008 04:45 PM

Delete record
 
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:retur n 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.

}

}

Arnab das 04-01-2008 09:56 AM

Re: Delete record
 
On Mar 31, 9:45*pm, CreativeMind <aftab.pu...@gmail.com> 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:retur n 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();
}


All times are GMT. The time now is 11:49 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.