Confirmation on delete in datagrid.

WilliamT

New Member
I am working in datagrid to display details. I have a asp:imagebutton for deleteing a specific row. It is working fine . the problem I have is to confirm the delete from user as we do with javascript 'confirm'. I can not put javascript in a datagrid since javascript is not a valid option in datagrid. <BR><BR>please through some light.<BR><BR>regards<BR>rajkumarhttp://www.aspalliance.com/aldotnet/examples/cd.aspx<BR><BR>Hope it is usefull,<BR><BR>Aniway, could you help me with this? Is about deleting too, I'm just searching a method that works for delete a row in a data grid which is quering to a mdb table...<BR><BR>Could you give me a simple example?<BR><BR>What is an imagebutton ?<BR><BR>Thanks,<BR><BR>Salvador Gallego.<BR>Thanks for your help. It works for me.<BR><BR>imagebutton is an alternate to button. we can show an image as button. <BR><BR>I hope the following will help you. <BR><BR>If you want to delete a row in datagrid put a invisible column which contains the unique key in the database table. Datagrid has a command 'OnItemCommand'. you can have a sub. pointing to this command. in the delete button put commandname='somestring'. in sub find that string and do the needed action. the sample code follows.<BR><BR><html><BR><head><BR><BR><script language="VB" runat="server"><BR><BR>Sub datagrid_itemcommand(objSender As Object, objArgs As DataGridCommandEventArgs)<BR> If objArgs.CommandSource.CommandName = "Delete" Then<BR> Dim Id AS Integer = objArgs.Item.Cells(1).Text<BR> deletesub(Id)<BR> End If<BR>End Sub<BR><BR>Sub deletesub(id as integer)<BR> ' use this id to delete the row.<BR> ' call bindgrid function <BR>end sub<BR><BR></script><BR><BR></head><BR><BR><body><BR><BR><ASP:DATAGRID id="Datagrid"<BR> runat="server" Width="100%" <BR> OnItemCommand="datagrid_itemcommand" ><BR> <BR><Columns><BR><asp:TemplateColumn HeaderText="Delete" HeaderStyle-Width="80"><BR><ItemTemplate> <BR> <asp:ImageButton id="DeleteImgButton" name="DeleteImgButton" runat="server" ImageUrl="image.gif" CommandName="Delete"></asp:ImageButton><BR></ItemTemplate><BR></asp:TemplateColumn><BR><asp:BoundColumn HeaderText="Id" DataField="Id" Visible="False" ></asp:BoundColumn><BR><!-- other columns --><BR></ASP:DATAGRID><BR><BR></body><BR><BR></html>That was just what i needed,<BR><BR>Greetings,<BR><BR>Salvador Gallego.
 
Back
Top