禁用在IE中灰显的按钮文本

本文关键字:按钮 文本 IE | 更新日期: 2023-09-27 18:32:57

在我的

代码中有条件地禁用一个链接按钮(C# + asp.net),它在不包括IE-8,IE-9的浏览器中工作正常。在此 当链接按钮禁用其文本颜色显示为灰色(但我将其应用于黑色)。

代码在这里

。.aspx

.view-btn-disable
        {
            float: left; 
            height: 46px;
            font-size: 14px !important;
            padding-top : 5px !important;
            color:black !important;
        }

    <telerik:RadGrid ID="dgCaregiver" BorderWidth="0px" CellPadding="0" AutoGenerateColumns="False"
                                            GridLines="None" Width="100%" ShowHeader="False" AllowPaging="True" CssClass="dggrid"
                                            runat="server" OnItemCommand="dgCaregiver_ItemCommand" OnItemDataBound="dgCaregiver_ItemDataBound"
                                            OnPageIndexChanged="dgCaregiver_PageIndexChanged" OnNeedDataSource="dgCaregiver_NeedDataSource"
                                            PageSize="25" PagerStyle-AlwaysVisible="true">
                                            <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" HorizontalAlign="center"
                                                AlwaysVisible="true" PagerTextFormat="{4}{5} Caregiver(s) in {1} page(s)" />
                                            <MasterTableView>
                                                <CommandItemSettings ExportToExcelImageUrl="mvwres://Telerik.Web.UI, Version=2010.1.415.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4/Telerik.Web.UI.Skins.Default.Grid.ExportToExcel.gif"
                                                    ExportToWordImageUrl="mvwres://Telerik.Web.UI, Version=2010.1.415.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4/Telerik.Web.UI.Skins.Default.Grid.ExportToWord.gif"
                                                    ExportToPdfImageUrl="mvwres://Telerik.Web.UI, Version=2010.1.415.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4/Telerik.Web.UI.Skins.Default.Grid.ExportToPdf.gif"
                                                    ExportToCsvImageUrl="mvwres://Telerik.Web.UI, Version=2010.1.415.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4/Telerik.Web.UI.Skins.Default.Grid.ExportToCsv.gif"></CommandItemSettings>
                                                <NoRecordsTemplate>
                                                    <div class="NoRecordsAvailable">
                                                        No records available
                                                    </div>
                                                </NoRecordsTemplate>
                                                <Columns>
                                                    <telerik:GridTemplateColumn HeaderText="CaregiverName" UniqueName="TemplateColumn4">
                                                        <ItemTemplate>
 <div id="divbtnedit" runat="server" class="view-btn-disable" style="margin-left: 0px;">
                                                                    <asp:LinkButton ID="lnkEdit" CommandName="edt" runat="server">Edit</asp:LinkButton>
                                                                </div>
                                                                <div id="divbtndel" runat="server" class="view-btn-disable">
                                                                    <asp:LinkButton ID="lnkDel" CommandName="del" runat="server">Delete</asp:LinkButton>
                                                                </div>
                                                            </div>
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                                </Columns>
                                            </MasterTableView>
                                        </telerik:RadGrid>

aspx.cs

 if (Session["UserID"].ToString().Trim() == id.Trim() || Session["RoleId"].ToString() == CommonCls.CaregiverRole_Admin.ToString())
                {
                    lnkDel.Attributes.Add("onclick", "return OpenDeleteDialog(this," + e.Item.ItemIndex + "," + DataBinder.Eval(e.Item.DataItem, "Id").ToString() + ",'" + lblCaregiverNM.Text + "');");
                    lnkDel.Enabled = true;
                    divbtndel.Attributes.Add("class", "view-btn");
                    lnkEdit.Enabled = true;
                    //lnkAssign.Enabled = true;
                    ibtnSendEmail.Visible = true;
                    ibtnSendSMS.Visible = true;
                    lblSendMailStatustxt.Visible = true;
                    lblSendSMSStatustxt.Visible = true;
                    divbtnedit.Attributes.Add("class", "view-btn");
                    //divbtnassign.Attributes.Add("class", "view-btn");
                }
                else
                {
                    lnkEdit.Enabled = false;
                    lnkDel.Enabled = false;
                    //lnkAssign.Enabled = false;
                    ibtnSendEmail.Visible = false;
                    ibtnSendSMS.Visible = false;
                    lblSendMailStatustxt.Visible = false;
                    lblSendSMSStatustxt.Visible = false;
                    divbtnedit.Attributes.Add("class", "view-btn-disable");
                    divbtndel.Attributes.Add("class", "view-btn-disable");
                }
                if (Session["UserID"].ToString().Trim() == id.Trim())
                {
                    lnkDel.Attributes["onclick"] = "return false;";
                    lnkDel.Enabled = false;
                    divbtndel.Attributes.Add("class", "view-btn-disable");                        
                }

有什么解决办法吗?

禁用在IE中灰显的按钮文本

通过大量搜索,我发现此功能是Internet Explorer内置的。