Click here to Skip to main content
16,021,115 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The delete button in gridview is automatically generated...
I want to ask the user for confirmation.....
I would like to use AJAX confirm button extender if possible....
The gridview is dynamically bound...
This means it does not have static columns..
Posted
Updated 8-Feb-13 20:41pm
v2

Try THis :

 <asp:templatefield headertext="Action" >

      <itemtemplate>
       <asp:linkbutton id="btnDelete" text="Delete" runat="server" commandname="Delete" onclientclick="<%# "return confirm(\"do you want to delete " + Eval("name") + "\")" %>"> </asp:linkbutton>
       </itemtemplate>
</asp:templatefield>


if you to display the name of user or else so you write Eval("name"). here "name" is the field from your db.

if any thing else you want so, please post it.


Mitesh
 
Share this answer
 
v2
Comments
Member 9644631 9-Feb-13 2:57am    
This button is not showing in my gridview..
Do i need to add anything in codebehind..
[no name] 11-Feb-13 6:56am    
you have solved the problem or not
XML
<asp:TemplateField>
                          
                           <asp:ImageButton ID="imgbtnCancel" runat="server" CommandName="Cancel" ImageUrl="~/images/del3.png" ToolTip="Cancel"  />
                               </EditItemTemplate>
                           <ItemTemplate>
                          
                            &nbsp;<span onclick="return confirm('Are you sure to Delete the Row?')">
                           <asp:ImageButton ID="imgbtnDelete" CommandName="Delete" Text="Delete" runat="server" ImageUrl="~/images/del2.png" ToolTip="Delete" Visible="False" /></span>
                           </ItemTemplate>
                           <HeaderStyle BorderStyle="None" Width="40px" />
                                  <ItemStyle Width="50px" />
                           </asp:TemplateField>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900