S
Stefano Mostarda
Hi there,
I have a problem.
I've a grid where sort is enabled.
I've handled the datagrid itemcreated event. In the code I add a bitmap
to the header of the column selected by the user.
Here's the code:
int i;
System.Web.UI.WebControls.Image imSortBitmap
if (e.Item.ItemType == ListItemType.Header){
for (i=0; i<grUser.Columns.Count; i++){
if (FSortExpressions == grUser.Columns.SortExpression){
imSortBitmap = new System.Web.UI.WebControls.Image();
imSortBitmap.ImageUrl = "images/" + ((stUserSearchField.SortOrder
== "DESC") ? "SortDesc.Gif" : "SortAsc.Gif");
e.Item.Cells.CssClass = "SelectedHeader";
e.Item.Cells.Controls.Add(imSortBitmap);
}
else{
grUser.Columns.HeaderStyle.CssClass = "Header";
}
}
}
I've handled the datagrid sortcommand event.
Here's the code
BindGrid(Convert.ToString(e.SortExpression));
The problem is that in the sortcommand event the e.SortExpression return
the sort expression of the column next to the one the user has selected.
If I comment the line which adds the bitmap to the cell in the
itemcreated event everything works fine.
Any ideas?
Thanks in advance
Stefano Mostarda MCP
Rome Italy
I have a problem.
I've a grid where sort is enabled.
I've handled the datagrid itemcreated event. In the code I add a bitmap
to the header of the column selected by the user.
Here's the code:
int i;
System.Web.UI.WebControls.Image imSortBitmap
if (e.Item.ItemType == ListItemType.Header){
for (i=0; i<grUser.Columns.Count; i++){
if (FSortExpressions == grUser.Columns.SortExpression){
imSortBitmap = new System.Web.UI.WebControls.Image();
imSortBitmap.ImageUrl = "images/" + ((stUserSearchField.SortOrder
== "DESC") ? "SortDesc.Gif" : "SortAsc.Gif");
e.Item.Cells.CssClass = "SelectedHeader";
e.Item.Cells.Controls.Add(imSortBitmap);
}
else{
grUser.Columns.HeaderStyle.CssClass = "Header";
}
}
}
I've handled the datagrid sortcommand event.
Here's the code
BindGrid(Convert.ToString(e.SortExpression));
The problem is that in the sortcommand event the e.SortExpression return
the sort expression of the column next to the one the user has selected.
If I comment the line which adds the bitmap to the cell in the
itemcreated event everything works fine.
Any ideas?
Thanks in advance
Stefano Mostarda MCP
Rome Italy