如何添加工具提示和确认消息框到ASP CommandField中(图像按钮) [英] how to add a tooltip and confirm message box to asp CommandField(image button)

查看:723
本文介绍了如何添加工具提示和确认消息框到ASP CommandField中(图像按钮)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

     <asp:GridView ID="GridView1" runat="server" 
                        AllowPaging="True" AllowSorting="True"
                        DataMember="DefaultView" 
                        DataSourceID="SqlDataSource1"...
     >
     <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:BoundField ...

                            <asp:CommandField  ButtonType="Image" DeleteText="Delete" ShowDeleteButton="True" DeleteImageUrl="images/deletered1.png"></asp:CommandField>                               
                        </Columns>                    
                        <FooterStyle BackColor="#507CD1" .../>
                    </asp:GridView>

我有一个一个℃的网格视图; ASP:CommandField中&GT; 中的每一行,但我不能找到一个prperty设置工具提示文本(删除 )或确认消息框(像你确定吗?是的否)

I have a grid view with a an <asp:CommandField> in every row but I can't find a prperty to set a tooltip text("delete") or confirm message box (something like "Are you sure?" Yes No)

推荐答案

尝试转换您的 CommandField中模板列 ,像这样的:

Try converting your CommandField to a TemplateField, like this:

<asp:TemplateField HeaderText="Delete">
    <ItemTemplate>
        <asp:Button ID="deleteButton" runat="server" CommandName="Delete" Text="Delete"
            OnClientClick="return confirm('Are you sure you want to delete this user?');" />
</ItemTemplate>
</asp:TemplateField>

然后你只需要处理您在$ 命令 C $ C-落后。

这篇关于如何添加工具提示和确认消息框到ASP CommandField中(图像按钮)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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