在ie9中没有显示渐变颜色,但是对于其他浏览器工作正常,我附上了示例代码供您参考。请给出相同的建议。
方案: 在devexpress网格行悬停时,将背景颜色更改为渐变颜色。
CSS
<style>
.dxgvDataRow:hover {
color: #FFFFFF !important;
background:rgba(108,195,221,0.95) ;
background: -moz-linear-gradient(top, rgba(135,224,253,1) 0%, rgba(108,195,221,0.95) 100%) !important; /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(135,224,253,1)), color-stop(100%,rgba(108,195,221,0.95))) !important; /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(135,224,253,1) 0%,rgba(108,195,221,0.95) 100%) !important; /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(135,224,253,1) 0%,rgba(108,195,221,0.95) 100%) !important; /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(135,224,253,1) 0%,rgba(108,195,221,0.95) 100%) !important; /* IE10+ */
background: linear-gradient(to bottom, rgba(135,224,253,1) 0%,rgba(108,195,221,0.95) 100%) !important; /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#87e0fd', endColorstr='#f26cc3dd',GradientType=0 ) !important; /* IE6-9 */
}
</style>
Aspx页面
<div class="MainDiv">
<div class="table-responsive">
<dx:ASPxGridView ID="grdProjects" runat="server" KeyFieldName="ProjectId" ClientInstanceName="grdProjects" Width="100%" >
<Styles Header-HorizontalAlign="Center" Header-VerticalAlign="Middle"
Header-Font-Bold="true">
</Styles>
<Columns>
<dx:GridViewDataTextColumn Caption="Job #" Width="70px" FieldName="ProjectId" CellStyle-HorizontalAlign="Left" Settings-AutoFilterCondition="Contains" VisibleIndex="1">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Tool" FieldName="Tool" CellStyle-HorizontalAlign="Left" Settings-AutoFilterCondition="Contains" VisibleIndex="2">
</dx:GridViewDataTextColumn>
</Columns>
<SettingsPager PageSize="5">
<PageSizeItemSettings Visible="true" />
</SettingsPager>
</dx:ASPxGridView>
</div>
</div>
代码
protected void Page_Load(object sender, EventArgs e)
{
DataSet dsgrdfrmMyjob = new DataSet();
DataTable dtfrmds = new DataTable();
dsgrdfrmMyjob.ReadXml(System.Web.Hosting.HostingEnvironment.MapPath("~/ProjectHistory.xml"));
DataTable dt = new DataTable();
DataColumn ProjectId = new DataColumn();
ProjectId.ColumnName = "ProjectId";
ProjectId.DataType = typeof(int);
dt.Columns.Add(ProjectId);
DataColumn Job = new DataColumn();
Job.ColumnName = "Job";
Job.DataType = typeof(string);
dt.Columns.Add(Job);
DataColumn Tool = new DataColumn();
Tool.ColumnName = "Tool";
Tool.DataType = typeof(string);
dt.Columns.Add(Tool);
dt.Clear();
dtfrmds.Clear();
dtfrmds = dsgrdfrmMyjob.Tables[0];
foreach (DataRow item in dtfrmds.Rows)
{
dt.Rows.Add(item.ItemArray);
}
if (dt != null && dt.Rows.Count > 0)
{
grdProjects.DataSource = dt;
grdProjects.DataBind();
}
else
{
grdProjects.DataSource = null;
grdProjects.DataBind();
}
}