toraj58
December 31st, 2008, 10:03 AM
how to get confirmation from the user before deleting a record in GridView?
|
Click to See Complete Forum and Search --> : [RESOLVED] GridView deleting Confirmation toraj58 December 31st, 2008, 10:03 AM how to get confirmation from the user before deleting a record in GridView? dannystommen December 31st, 2008, 12:04 PM use the rowdeleting event protected void Gridview1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //ask for confirmation e.Cancel = true; } toraj58 December 31st, 2008, 12:30 PM how to ask for confirmation; i don't want cause a postback. dannystommen December 31st, 2008, 12:38 PM I don't know exactly how, but if you don't want postback, you need to use a clientside script such as Javascript. But why don't you want a postback? toraj58 December 31st, 2008, 12:43 PM basically user is not convenience with a postback. there is javascript fanction (confirm) that ask a question from the user but i don't know how to access the returned answer in asp.net. i have done it before in PHP. dannystommen December 31st, 2008, 12:45 PM if you use an AJAX update panel, the user won't see the postback toraj58 December 31st, 2008, 12:47 PM i tried to install AJAX for .net 2.0 in visual stadio 2005 but when i wanted to add the library to the toolbox unfortunately i recied error.... it seems that ajax for .net 2.0 is not stable. nabeelisnabeel January 1st, 2009, 02:10 AM You can provide the 'Delete' link button in template field and write something like this in its onClientClick event <asp:LinkButton runat="server" ID="btnDelete" CommandName="Delete" OnClientClick="return confirm('Are you sure you want to delete?');" Text="Delete" ></asp:LinkButton> toraj58 January 3rd, 2009, 10:13 AM thanks it works. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |