1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.CssClass = "header";
e.Row.Height = Unit.Pixel(10);
foreach (TableCell cell in e.Row.Cells)
{
if (cell.HasControls())
{
LinkButton button = cell.Controls[0] as LinkButton;
System.Web.UI.HtmlControls.HtmlGenericControl gv = new HtmlGenericControl("div");
Label lnkName = new Label();
lnkName.Text = button.Text;
if (button != null)
{
System.Web.UI.WebControls.Image imageSort = new System.Web.UI.WebControls.Image();
imageSort.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "Library.Imgs.bg.gif");
if (this.SortExpression == button.CommandArgument)
{
if (this.SortDirection == SortDirection.Ascending)
{
imageSort.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "Library.Imgs.asc.gif");
}
else
{
imageSort.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "Library.Imgs.DESC.gif"); ;
}
}
gv.Controls.Add(lnkName);
gv.Controls.Add(imageSort);
button.Controls.Add(gv);
}
}
}
} |
Partager