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

[Solved] RadGrid wont sort in opposite direction + other issues

2 Answers 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 03 Nov 2009, 02:09 PM
Hi boys and girls,
  I'm having an issue with a RadGrid where the sorting mechanism wont alternate directions, after click the column name again.  Also, if I click the actual sorting arrow image, it changes the sorted column to the column to the right of it.  Lastly, the paging mechanism removes any sort that is applied to the RadGrid. 

I'm guessing these issues are all related, but I'm not sure what the cause is.  Currently I and handling the NeedDataSource event, and programmatically binding the grid depending on whether certain options are entered on the screen.  However, when sorting, these options don't change, so the issue shouldn't be that, but I'm not 100%.  Also, I don't have any advanced settings configured with the grid.  Just the columns definitions, sorting enabled, paging enabled, EnableRowHoverStyle, and EnablePostBackOnRowClick.  In fact, here is the markup:

<telerik:RadGrid runat="server" ID="uxRadGrid" AllowFilteringByColumn="False" GridLines="None" 
    Skin="Simple" AutoGenerateColumns="False" OnNeedDataSource="uxRadGrid_NeedDataSource" 
    OnItemCommand="uxRadGrid_ItemCommand" OnSortCommand="uxRadGrid_SortCommand"
    <MasterTableView DataKeyNames="id"  AllowPaging="True" 
        AllowSorting="True"
        <Columns> 
            <telerik:GridBoundColumn DataField="id" UniqueName="id" AutoPostBackOnFilter="true" 
                AllowFiltering="False" FilterControlWidth="30" AllowSorting="true" SortExpression="id" 
                HeaderText="Incident ID"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="product" AutoPostBackOnFilter="true" AllowFiltering="False" 
                FilterControlWidth="40" AllowSorting="true" HeaderText="Product" SortExpression="product"
            </telerik:GridBoundColumn> 
            <telerik:GridDateTimeColumn DataField="comment" DataFormatString="{0:yyyy-MM-dd}" 
                AutoPostBackOnFilter="true" FilterControlWidth="40" AllowFiltering="false" AllowSorting="true" 
                HeaderText="Date" SortExpression="comment"
            </telerik:GridDateTimeColumn> 
            <telerik:GridBoundColumn DataField="description" AutoPostBackOnFilter="true" AllowFiltering="False" 
                AllowSorting="true" SortExpression="description" HeaderText="Description" ItemStyle-Width="50%"
                <ItemStyle Width="50%" /> 
            </telerik:GridBoundColumn> 
        </Columns> 
        <RowIndicatorColumn> 
            <HeaderStyle Width="20px" /> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn> 
            <HeaderStyle Width="20px" /> 
        </ExpandCollapseColumn> 
    </MasterTableView> 
    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true"></ClientSettings> 
    <FilterMenu EnableTheming="True"
        <CollapseAnimation Duration="200" Type="OutQuint" /> 
    </FilterMenu> 
</telerik:RadGrid> 


Any ideas?  Thanks in advance!

2 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 03 Nov 2009, 02:58 PM
So I tried using a ListView with the DataPager control, and it seemed to have similar issues.  I had to click twice on the paging buttons to actually get the page to change.

I feel like it has something to do with the way I'm getting my data.  My data is being pulled from an API, and is returned in the form of a DataTable, which I then bind to the RadGrid or ListView.

Has anyone seen anything like this before?
0
Sebastian
Telerik team
answered on 03 Nov 2009, 03:01 PM
Hi John,

If you use advanced binding with NeedDataSource event handling for both controls as illustrated below:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax-beta/listview/examples/databinding/simplevsadvancedbinding/defaultcs.aspx

The paging feature should work as expected. Please compare your implementations with those and outline the differences as they can lead us to the source of the issue to eliminate it asap.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or