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

Grid Sorting Issue

1 Answer 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohamed
Top achievements
Rank 1
Mohamed asked on 15 Sep 2013, 11:32 AM
Dears , 
            I have Strange Issue , i enabled sorting to my Grid as the documentation said and follow every thing in the documentations but when i press on the column header to sort , no thing happened ?!  the Grid remained unsorted!...how can i solve it 
here is my code

  <telerik:RadGrid CssClass="paper-table table table-paper table-striped table-sortable table-bordered"
                ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="SqlDataSource1" EnableLinqExpressions="False"
                ShowStatusBar="True" GridLines="None" AllowSorting="True" AllowFilteringByColumn="True"
                EnableAjax="true" BorderStyle="Solid" BorderWidth="1px" AllowPaging="True" OnItemDataBound="RadGrid1_ItemDataBound"
                OnNeedDataSource="RadGrid1_NeedDataSource">
                
                <AlternatingItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                <MasterTableView DataSourceID="SqlDataSource1" HierarchyLoadMode="Client" AutoGenerateColumns="False"
                    AllowFilteringByColumn="true" 
                    GroupLoadMode="Client" 
                    DataKeyNames="CardId"
                    AllowSorting="true">
                    <DetailTables >
                        
                        <telerik:GridTableView  DataSourceID="SqlDataSource2" BorderColor="Black" DataKeyNames="FK_Card"
                            BorderStyle="Solid" GridLines="Both" AllowFilteringByColumn="false" HierarchyDefaultExpanded="True">
                            
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="CardId" MasterKeyField="CardId" />
                            </ParentTableRelation>


                            <CommandItemSettings ExportToPdfText="Export to PDF" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                <HeaderStyle Width="20px" />
                            </ExpandCollapseColumn>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                </EditColumn>
                            </EditFormSettings>
                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            <AlternatingItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        </telerik:GridTableView>
                    </DetailTables>
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="#" AllowFiltering="false">
                            <ItemTemplate>
                                <asp:Label ID="numberLabel" runat="server" Width="30px" />
                            </ItemTemplate>
                            <HeaderStyle Width="30px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="CardNo" FilterControlAltText="Filter CardNo column"
                            HeaderText="Card id" SortExpression="CardNo" UniqueName="CardNo" AllowFiltering="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Status_Description" FilterControlAltText="Filter Status_Description column"
                            HeaderText="Status" SortExpression="Status_Description" UniqueName="Status_Description"
                            AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                        
                        
                        </telerik:GridBoundColumn>
                       
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                    <ItemStyle BackColor="Transparent" BorderColor="Black" BorderStyle="Solid" HorizontalAlign="Center"
                        VerticalAlign="Middle" />
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </MasterTableView>
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"
                    VerticalAlign="Middle" />
                <PagerStyle PageButtonCount="15" EnableSEOPaging="True" />
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>

Kindly i need help in this section , because i have a delivery date !!

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Sep 2013, 04:42 AM
Hello,

I am not able to find any issue/mistake in your code.

Can you please use remove either DataSourceID or OnNeedDataSource and check it again?

Let me know if any concern.

<telerik:RadGrid
DataSourceID="SqlDataSource1"
OnNeedDataSource="RadGrid1_NeedDataSource">


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Mohamed
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or