0

在我的代码(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");                        
                }

有什么解决办法吗?

4

1 回答 1

0

By Lots of searching, I found that this feature is Internet Explorer inbuilt.

于 2013-10-22T11:55:20.667 回答