[英]How to add a sorting Image to a GridView Header while working with ObjectDataSource or EntityDataSource
I want to know how can we use sorting image inside GridView
header while we use ObjectDataSource
or Entity Framework.我想知道在使用ObjectDataSource
或实体框架时如何在GridView
header 中使用排序图像。 Because that has direct calling feature and also having sorting expression.因为它具有直接调用功能并且还具有排序表达式。
So, how can i use GridView.RowCreated
event and get the sort expression to bind the sorting image?那么,如何使用GridView.RowCreated
事件并获取排序表达式来绑定排序图像?
That was for older ASP.NET 2.0 days.那是针对较旧的 ASP.NET 2.0 天。 ASP.NET 4.0 allows us to specify it as a asp:GridView
property ASP.NET 4.0 允许我们将其指定为asp:GridView
属性
MSDN Links MSDN 链接
GridView Markup GridView 标记
<SortedAscendingHeaderStyle CssClass="sortasc" />
<SortedDescendingHeaderStyle CssClass="sortdesc" />
css css
.datatable th
{
font-size:12px;
font-weight:bold;
letter-spacing:0px;
text-align:left;
padding:2px 4px;
color:#333333;
border-bottom:solid 2px #bbd9ee;
}
.datatable th a
{
text-decoration:underline;
padding-right:18px;
color:#000;
}
.datatable th.sortasc a { background:url(../Images/asc.gif) right center no-repeat; }
.datatable th.sortdesc a { background:url(../Images/desc.gif) right center no-repeat; }
Please note that the asp:GridView
has been assigned CssClass="datatable"
.请注意,已为asp:GridView
分配了CssClass="datatable"
。
You might also want to check out SortedAscendingCellStyle and SortedDescendingCellStyle您可能还想查看SortedAscendingCellStyle和SortedDescendingCellStyle
For old fashioned way, try this.对于老式的方式,试试这个。http://mattberseth.com/blog/2007/10/a_yui_datatable_styled_gridvie.htmlhttp://mattberseth.com/blog/2007/10/a_yui_datatable_styled_gridvie.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.