Problem and Solutions

1

Like

How to display confirmation box in DetailsView


Hi All

I want to display Confirmation Message box on row delete and update. Please help me to do this.

Thanks & Regards
Posted by: Sam
On 15 Apr 2012 | Views: 1882 | Categories: ASP.NET
Solutions(1)
 On 15 Apr 2012 10:11:35 AM
Hai Sam,

For the details view, you need to add the event on DataBound event so that when the data is getting binded with the item, the event will be attached with the item.

See the below code which will be helpful for you.


protected void MyDetailsView_DataBound(object sender, EventArgs e)
{
Button btnDel= (Button)e.Row.Cells[0].FindControl("btnDelete");
if(btnDel != null)
btnDel.OnClientClick = string.Format(
"return confirm('Are you sure you want to delete the item with id {0}?');", e.Row.Cells[1].Text));
}

I hope i will help to solve your problem
Post your Solutions  

 

Other lins

.Net Techies
Other lins