Doug Rutledge
Top achievements
Rank 1
Doug Rutledge
asked on 18 Aug 2008, 08:34 PM
I've noticed that the SortedBackColor on my RadGrids does not clear when I toggle the sort to "None" when I have AutoGenerateColumns="False". Does anyone know of a work around or fix for this?
Doug
Doug
3 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 19 Aug 2008, 06:09 AM
Hi Doug,
One suggestion would be to set the backcolor for the sorted column in the code behind instead of setting the SortedBackColor property.
CS:
Thanks
Shinu.
One suggestion would be to set the backcolor for the sorted column in the code behind instead of setting the SortedBackColor property.
CS:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
if (e.Item.OwnerTableView.SortExpressions.Count > 0) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
item["columnUniqueName"].BackColor = System.Drawing.Color.Red; |
} |
} |
} |
Thanks
Shinu.
0
Brian
Top achievements
Rank 1
answered on 18 Sep 2008, 09:32 PM
I have been experiencing the same issue. When I tried using the code sample above, I get an error stating that
"Cannot find a cell bound to column name 'columnUniqueName'"
Am I missing something or was the example above incomplete?
"Cannot find a cell bound to column name 'columnUniqueName'"
Am I missing something or was the example above incomplete?
0
Shinu
Top achievements
Rank 2
answered on 19 Sep 2008, 04:44 AM
Hi Brian,
UniqueName is the column property which you need to set. So that you can access any cell of the Grid in the code behind using this property.
ASPX:
CS:
Thanks
Shinu.
UniqueName is the column property which you need to set. So that you can access any cell of the Grid in the code behind using this property.
ASPX:
<telerik:GridBoundColumn DataField="ProductName" UniqueName="ProductName" HeaderText="ProductName" SortExpression="ProductName" > |
</telerik:GridBoundColumn> |
CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
if (e.Item.OwnerTableView.SortExpressions.Count > 0) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
item["ProductName"].BackColor = System.Drawing.Color.Red; |
} |
} |
} |
Thanks
Shinu.