This is a migrated thread and some comments may be shown as answers.

Sort column not formatted after setting the header or item style css class

3 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan Ramler
Top achievements
Rank 1
Dan Ramler asked on 26 Jul 2010, 08:57 PM
If I set either the HeaderStyle CssClass or the ItemStyle CssClass value the "rgSorted" class isn't being added to the column on the grid.

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 01 Aug 2010, 04:12 PM
Hello Dan,

Unfortunately I'm unable to reproduce this issue on my end. Please download the attached project (fully runnable) and let me know if I'm missing something.

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dan Ramler
Top achievements
Rank 1
answered on 01 Aug 2010, 05:32 PM
If the item css is set on an individual column, it stops adding the rgSorted class to those specific TD cells.

(See attached screen shot)
0
Daniel
Telerik team
answered on 05 Aug 2010, 11:27 AM
Hello Dan,

Thank you for the clarification. Due to compatibility reasons, the rgSorted style is applied only to columns which do not have an ItemStyle declared explicitly.

You could try the following workaround:
.myCssClass
{
    background-color: Red;
}

<telerik:GridBoundColumn
      DataField="ID"
      HeaderText="ID"
      UniqueName="MyColumn"
      SortExpression="ID">
    <ItemStyle CssClass="myCssClass" />
</telerik:GridBoundColumn>

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if ((sender as RadGrid).MasterTableView.SortExpressions.ContainsExpression("ID"))
    {
        GridItem[] headerItems = (sender as RadGrid).MasterTableView.GetItems(GridItemType.Header);
        foreach (GridDataItem item in (sender as RadGrid).MasterTableView.Items)
            item["MyColumn"].CssClass = "rgSorted myCssClass";
    }
}

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Dan Ramler
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Dan Ramler
Top achievements
Rank 1
Share this question
or