Deleting rows in a datagrid

R

Ridhi

I have a datagrid wherein each row has a check box. the
user has to select the rows which he wants to delte. After
doing that and click "Delete" the user shpuld be prompted
for "Delete yes? or no?" id yes is clicked go ahead and
delete..or if no"Cancle the operation".Can anybody tell me
how to do this.

thanks in advance
 
A

Alvin Bruney

Please examine the code provided, it achieves what you want.
private void TrunkGroup_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)

{

LinkButton deleteButton = ((LinkButton)e.Item.Cells[0].Controls[0]);

deleteButton.Attributes.Add("onClick", "event.returnValue=confirm('Are you
sure you wish to delete this item?');");

}
}
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top