Tooltip不会在IE 8,Chrome,FF for gridview命令字段更新中显示,取消ASP.Net中的按钮 [英] Tooltip not displaying in IE 8, Chrome, FF for gridview command field update, cancel buttons in ASP.Net

查看:105
本文介绍了Tooltip不会在IE 8,Chrome,FF for gridview命令字段更新中显示,取消ASP.Net中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的gridview包含一个命令字段,其中'showsit'按钮属性设置为true。所有功能都工作正常,除了工具提示不会显示自动生成的更新取消按钮,而是显示工具提示为编辑本身,这是工具提示'编辑'按钮。它在IE兼容性视图中正确显示,但不在IE 8或Chrome或FF浏览器中显示!我在网上搜索,大多数解决方案建议使用模板字段而不是命令字段,我的问题是在这个阶段实现模板字段会导致很多代码更改。请建议这是否可能在命令领域本身! gridview设计代码如下:

My gridview consists of a command field with 'showedit' button property set to true. All functionalites are working fine except that tooltip is not displaying for the autogenerated update and cancel buttons, instead it displays tooltip as 'edit' itself which is the tooltip for 'edit' button. It is displaying correctly in IE compatibility view but not in IE 8 or Chrome or FF browsers!. I searched in net, most solutions suggested to use template field instead of command field, my problem is at this stage implementing template field will result in lot of code changes. Please suggest whether this is possible in Command field itself! The gridview design code is given below:

<asp:CommandField ButtonType="Image" ShowEditButton="True" ValidationGroup="EditAnswer" CancelImageUrl="../images/Cancel.jpg" CancelText="Click to cancel" UpdateImageUrl="../images/Update.jpg" UpdateText="Click to save this answer" EditImageUrl="../images/Edit.jpg" EditText="Click to edit this answer">              <ControlStyle CssClass="para1" />                                                      <ItemStyle HorizontalAlign="Center" Width="10%" />                             </asp:CommandField>

我试着为自动生成的更新和取消按钮设置工具提示,但这也失败了,因为我无法在行数据绑定事件中获取更新和取消按钮的控件。

I tried setting tooltip for autogenerated update and cancel buttons also but this also failed because I am not able to get the controls for update and cancel buttons in row databound event.

推荐答案

我已经在gridview的行中使用命令字段本身实现了此功能数据绑定事件,

I have implemented this functionality using command field itself in gridview's row databound event,

    if (e.Row.RowType == DataControlRowType.DataRow)
    {            
        e.Row.Cells[2].ToolTip = "Click to Edit answer";
        if (e.Row.RowState == DataControlRowState.Edit || e.Row.RowState.ToString() == "Alternate, Edit")
        {
            int i = 0;
            foreach (TableCell cell in e.Row.Cells)
            {
                if (e.Row.Cells.GetCellIndex(cell) == 2)
                {
                    ((System.Web.UI.WebControls.ImageButton)(e.Row.Cells[2].Controls[0])).ToolTip = "Click to update answer";
                    ((System.Web.UI.LiteralControl)(e.Row.Cells[2].Controls[1])).Text = "&nbsp;";
                    ((System.Web.UI.WebControls.ImageButton)(e.Row.Cells[2].Controls[2])).ToolTip = "Click to cancel answer";
                }
                i++;
            }
        }
    }

浏览器!

这篇关于Tooltip不会在IE 8,Chrome,FF for gridview命令字段更新中显示,取消ASP.Net中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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