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

Radgrid alternate row color style

3 Answers 241 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Babu
Top achievements
Rank 1
Babu asked on 21 Apr 2015, 02:52 PM

Hi

I have a RadGrid with skin ="windows 7" and works find and the alternating row color works like a charm.

Problem arisies when i have one of the column as sorted uisng GridSortExpression

Column which is used in GridSortExpression is not applied altrenatinmg row color - any advise would be appreciated and attached is the screen shot

and below is the code 

<telerik:RadGrid ID="rgRoleMappingL1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting ="True" AutoGenerateColumns="False"
                                        CellSpacing="0" GridLines="None"
                                        OnNeedDataSource="rgRoleMappingL1_NeedDataSource" 
                                        OnPageSizeChanged="rgRoleMappingL1_PageSizeChanged" OnSortCommand="rgRoleMappingL1_SortCommand" PageSize="20" Width="100%" Skin="Windows7">
                                        <MasterTableView>
                                             
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="RoleMapL1ID" AutoPostBackOnFilter="true" FilterControlAltText="Filter RoleMapL1ID column"
                                                    HeaderText="ID" UniqueName="RoleMapL1ID" Visible="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="BusinessRole" AutoPostBackOnFilter="true" FilterControlAltText="Filter BusinessRole column"
                                                    HeaderText="Business Role" UniqueName="BusinessRole" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="AppRoleL1" FilterControlAltText="Filter AppRoleL1 column"
                                                    HeaderText="Application Role (Level1)" UniqueName="AppRoleL1" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Usertype" FilterControlAltText="Filter Usertype column"
                                                    HeaderText="Sponsor/Site User?" UniqueName="Usertype" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="DBL" FilterControlAltText="Filter DBL column"
                                                    HeaderText="DBL?" UniqueName="DBL" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Scope" FilterControlAltText="Filter Scope column"
                                                    HeaderText="Scope" UniqueName="Scope" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" HeaderTooltip="Protocol,Country,Site">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Hierarchy" FilterControlAltText="Filter Hierarchy column"
                                                    HeaderText="Hierarchy" UniqueName="Hierarchy" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                 <telerik:GridBoundColumn DataField="Expired" FilterControlAltText="Filter Expired column"
                                                    HeaderText="Disabled?" UniqueName="Expired" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Edit" FilterControlAltText="Filter Edit column"
                                                    HeaderText="" UniqueName="Edit" AllowFiltering="false">
                                                </telerik:GridBoundColumn>
                                            </Columns>
                                                <NoRecordsTemplate>
                                                    <div style="margin:10px">
                                                        There are no roles mapped at this time.
                                                    </div>
                                                </NoRecordsTemplate>
                                            <SortExpressions>
                                                <telerik:GridSortExpression FieldName="BusinessRole" SortOrder="Ascending" />
                                            </SortExpressions>
                                        </MasterTableView>
                                    </telerik:RadGrid>

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 24 Apr 2015, 07:11 AM
Hello Babu,

To achieve this requirement, you can disable the following property:
Copy Code
<SortingSettings EnableSkinSortStyles="false" />

That should do the trick. Please give it a try and let me know if it works for you.


Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Babu
Top achievements
Rank 1
answered on 24 Apr 2015, 01:46 PM

Thanks Eyups thsi worked like a charm.

I had tried another way of sorting by using the SortExpression in the Telerik:bound column itself

 

<telerik:GridBoundColumn DataField="BusinessRole" AutoPostBackOnFilter="true" FilterControlAltText="Filter BusinessRole column"
HeaderText="Business Role" UniqueName="BusinessRole" CurrentFilterFunction="Contains" SortExpression="Ascending">

 

Which would be more effiecient for sorting by using the in GridBoudColumn itself or using SortExpressions after all the Columns in the grid are defined??

0
Eyup
Telerik team
answered on 29 Apr 2015, 08:15 AM
Hi Babu,

You should use the SortExpressions tag when applying initial sorting. The SortExpression property of the column only defines the name of the Field from your database which will be used when the user sorts this column.

Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Babu
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Babu
Top achievements
Rank 1
Share this question
or