当我使用项目模板在GridView中删除行时如何获取确认框 [英] How get confirm box when i am deleting row in gridview using item template
本文介绍了当我使用项目模板在GridView中删除行时如何获取确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想在使用项目模板在网格视图中删除时确认框,您可以引导或发送任何代码片段吗?
Hello,
I want to confirm box while i am deleting in grid view using item template can u guide or send any snippets
推荐答案
尝试以下操作:
Try this:
<asp:gridview datakeynames="CategoryID" id="GridView1" runat="server" autogeneratecolumns="False" xmlns:asp="#unknown">
OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" OnRowDeleted="GridView1_RowDeleted"
OnRowDeleting="GridView1_RowDeleting">
<columns>
<asp:boundfield datafield="CategoryID" headertext="CategoryID" />
<asp:boundfield datafield="CategoryName" headertext="CategoryName" />
<asp:templatefield headertext="Select">
<itemtemplate>
<asp:linkbutton id="LinkButton1" commandargument="<%# Eval("CategoryID") %>" commandname="Delete" onclientclick="return confirm('Are you sure you want to delete this Category?');">
runat="server">Delete</asp:linkbutton>
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
Refef:
使用JavaScript确认删除GridView的CommandField [
Refef:
Confirm delete for GridView''s CommandField using JavaScript[^]
您可以使用Javascript警报消息来允许用户在两者之间进行选择-请参见 ^ ].
You can use a Javascript alert message to allow the user to choose between the two - see
ASP.Net Server Side Yes No Confirmation Box using JavaScript[^].
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ibtnCancel" runat="server" ImageUrl="~/images/Cancel_New.gif"
ToolTip="Cancel Scheme" CssClass="groovybutton" OnClientClick="return confirm('Do you want to cancel plan?');" Visible="false" OnCommand="ibtnCancel_Command" />
</ItemTemplate>
</asp:TemplateField>
写相同的删除确定
可能会对您有帮助
谢谢
ChetanV
write the same for delete ok
may be this will help you
thank you
ChetanV
这篇关于当我使用项目模板在GridView中删除行时如何获取确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文