在gridview中确认删除 [英] Confirm delete in gridview

查看:63
本文介绍了在gridview中确认删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gridview中的删除按钮会自动生成...

我想要求用户确认.....

我想用AJAX确认如果可能的话,按钮扩展器....

gridview是动态绑定的...

这意味着它没有静态列..

解决方案

试试这个:



< asp:templatefield headertext =Action> 

< itemtemplate>
< asp:linkbutton id =btnDeletetext =删除runat =servercommandname =删除onclientclick =<%#返回确认(\是否要删除+ Eval(名称)+\)%>> < / ASP:LinkBut​​ton的>
< / itemtemplate>
< / asp:templatefield>





如果要显示用户名或其他你写Eval(名称)。这里名字是你的数据库中的字段。



如果您有任何其他想要的东西,请发布。





Mitesh


GridView删除,确认 [ ^ ]

也可以使用JS完成: http://geekswithblogs.net/dotNETvinz/archive/2009/02/22/display-confirmation-message-on-gridview-deleting.aspx [< a href =http://geekswithblogs.net/dotNETvinz/archive/2009/02/22/display-confirmation-message-on-gridview-deleting.aspx\"target =_ blanktitle =New Window> ^ ]



HT tp://www.aspdotnet-suresh.com/2011/01/how-to-delete-records-in-gridview-with.html [ ^ ]


< blockquote>

 <   asp:TemplateField  >  

< asp:ImageButton ID = imgbtnCancel runat = server CommandName = 取消 ImageUrl = 〜/ images / del3.png 工具提示 = 取消 / >
< / EditItemTemplate >
< ItemTemplate >

& nbsp; < span onclick = 返回确认('您确定要删除行吗?') >
< asp:ImageButton ID = imgbtnDelete CommandName = 删除 文字 = 删除 runat < span class =code-keyword> = server ImageUrl = 〜/ images / del2.png 工具提示 = 删除 可见 = 错误 / > < / span >
< / ItemTemplate >
< HeaderStyle BorderStyle = 宽度 = 40px / >
< ItemStyle 宽度 = 50px / >
< / asp:TemplateField >


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..

解决方案

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


GridView Delete, with Confirmation[^]
Can be simply done using JS as well : http://geekswithblogs.net/dotNETvinz/archive/2009/02/22/display-confirmation-message-on-gridview-deleting.aspx[^]

http://www.aspdotnet-suresh.com/2011/01/how-to-delete-records-in-gridview-with.html[^]


<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>


这篇关于在gridview中确认删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆