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

Manually showing sort Icon

5 Answers 276 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mrutunjaya Das
Top achievements
Rank 1
Mrutunjaya Das asked on 10 Nov 2010, 11:14 AM
Hi All,

I have a telerik grid and sorting works fine with it. The problem arises when I try to refresh the page when the grid is sorted. The sort icon which appears on the column header of the grid is missing , where as the grid contains the sorted data.

Someone please tell me how to manually show the arrow Mark from the code behind.

Thanks

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Nov 2010, 11:56 AM
Hi Mrutunjaya,

I tried to replicate the described issue in this example but to no avail. Please give it a try and let me know what is the difference in your scenario.

Regards,
Pavlina
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
Mrutunjaya Das
Top achievements
Rank 1
answered on 10 Nov 2010, 12:17 PM
Hi Pavlina,

Thank you for the reply. Your example is working fine. There is some difference between yours and mine. You are using the Datasource="sqlDataSOurce1" in your grid , where as in my case I am handling onNeedDatasource event. So data feeding to the grid is done from the code behind of my page. 

I am not sure, but what I am guessing is showing of sort icon is handled internally in telerik grid when "OnSortCommand" event is fired. In my case page refreshing doesn't invoke the handler of the above event. So I need to somehow manually show the sort icon.

What I am doing is , I am including the below line in my page_Load

this.MyGrid.Columns.FindByDataField("ColumnName").ShowSortIcon = true;

Which doesn't seem to be affecting the grid.

Will appreciate some light on this.

Thank You
0
Pavlina
Telerik team
answered on 10 Nov 2010, 05:10 PM
Hello Mrutunjaya,

Can you paste your aspx and code-behind (please, use the code-formatter tool of the ticket editor). We will test it locally and advise you further.

Thanks.

All the best,
Pavlina
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
Mrutunjaya Das
Top achievements
Rank 1
answered on 11 Nov 2010, 06:32 AM
<telerik:RadGrid ID="MyGrid" AllowCustomPaging="true" runat="server" GridLines="None"
                AllowSorting="true" EnableLinqExpressions="true" OnItemCreated="MyGrid_ItemCreated"
                OnDetailTableDataBind="MyGrid_DetailsTableDataBind" PageSize="20" OnNeedDataSource="MyGrid_NeedDataSource"
                OnPageIndexChanged="MyGrid_PageIndexChanged" AutoGenerateColumns="false"
                OnPageSizeChanged="MyGrid_PageSizeChanged" OnItemCommand="MyGrid_ItemCommand"
                OnItemDataBound="MyGrid_ItemDataBound" OnPreRender="MyGrid_PreRender"
                OnExcelExportCellFormatting="MyGrid_ExcelExportCellFormatting" OnSortCommand="MyGrid_SortCommand">
                <SortingSettings EnableSkinSortStyles="false" />
                <ClientSettings AllowExpandCollapse="true">
                </ClientSettings>
                <MasterTableView AllowSorting="true" AllowPaging="true" DataKeyNames="FundId" EditMode="InPlace"
                    VirtualItemCount="20" HierarchyLoadMode="Client">
                    <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true"
                        ShowExportToCsvButton="true" ShowExportToPdfButton="true" />
                    <Columns>
                        <telerik:GridTemplateColumn HeaderText="ID" UniqueName="ID" SortExpression="Id">
                            <ItemTemplate>
                                <div>
                                    <asp:Label ID="label1" runat="server" Text='<%# Highlight("" + DataBinder.Eval(Container.DataItem, "Id"),"<span class=\"highlightRed\" style=\"text-decoration:underline;\">", "</span>")%>'></asp:Label>
                                </div>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
</MasterTableView>
</telerik:RadGrid>


I have handled every event in code behind. But when I refresh the page I have a flag that tells me
whether the grid contains the sorted list or not. I just need to know how to show the arrow button
for the sorted column from code behind. Right Now what I am using is 

this.MyGrid.Columns.FindByDataField("ID").ShowSortIcon = true;

Which isn't working. If you need me to provide any of the event handler, Please let me know.

Thanks


0
Pavlina
Telerik team
answered on 11 Nov 2010, 01:16 PM
Hello Mrutunjaya,

I made a simplified version of your code scenario. Please examine the attachment and let me know what differs in your case.

I hope this helps.

All the best,
Pavlina
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
Mrutunjaya Das
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Mrutunjaya Das
Top achievements
Rank 1
Share this question
or