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

[Solved] Sorting problem

3 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rizk
Top achievements
Rank 1
rizk asked on 05 Aug 2009, 12:30 PM
Hi
i use radGrid with GridTemplateColumn, which hold link buttons for doing many action, but when i try to sort any column, and then click at any of these buttons, the grid forget the sort order,
here is my grid
<telerik:RadGrid ID="grdNewContent" runat="server" AllowPaging="True" AllowSorting="True"
                        CssClass="listItems" AutoGenerateColumns="False" GridLines="None" AutoGenerateEditColumn="false"
                        Skin="SitefinityItems" EnableEmbeddedSkins="false" PageSize="50" AllowMultiRowSelection="true"
                        AllowFilteringByColumn="false">
                        <PagerStyle AlwaysVisible="true" Mode="NumericPages" />
                        <ClientSettings>
                            <Selecting AllowRowSelect="true" />
                        </ClientSettings>
                        <MasterTableView>
                            <RowIndicatorColumn Visible="false">
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn Resizable="false" Visible="false">
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridClientSelectColumn ItemStyle-CssClass="gridActions">
                                </telerik:GridClientSelectColumn>
                                <telerik:GridTemplateColumn UniqueName="Action" HeaderText="<%$Resources:Action %>"
                                    ItemStyle-CssClass="gridActions edit" Reorderable="true">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnPublish" Text="<%$Resources:Publish %>" runat="server" CommandName="Publish"
                                            Visible="false" />
                                        <asp:LinkButton ID="btnEdit" Text="<%$Resources:Edit %>" runat="server" CommandArgument='<%#Eval("Id") %>'
                                            Visible="false" />
                                        <asp:LinkButton ID="btnReject" Text="<%$Resources:Reject %>" runat="server" CommandName="Reject"
                                            Visible="false" CommandArgument='<%#Eval("Id")%>' />
                                        <asp:LinkButton ID="btnRestore" Text="<%$ Resources:Restore %>" runat="server" CommandArgument='<%#Eval("Id") %>'
                                            Visible="false" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridButtonColumn ConfirmText="<%$ Resources:AreYouSure %>" CommandName="Delete"
                                    ItemStyle-CssClass="gridActions delete" HeaderText="<%$ Resources:Delete %>"
                                    ButtonType="LinkButton" UniqueName="Delete">
                                </telerik:GridButtonColumn>
                                <telerik:GridTemplateColumn HeaderText='<%$Resources:PostTitle %>' UniqueName="Title"
                                    SortExpression="Title" ItemStyle-CssClass="gridContentTitle">
                                    <ItemTemplate>
                                        <asp:LinkButton runat="server" ID="btnPreview" CommandArgument='<%# Eval("Id") %>'
                                            Text='<%# Eval("TruncatedTitle") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderText="<%$Resources:Author %>" UniqueName="Author"
                                    SortExpression="AuthorName" DataField="Author">
                                    <FilterTemplate>
                                    </FilterTemplate>
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="<%$Resources:Created %>" UniqueName="Created"
                                    SortExpression="PostDate" DataField="PostDate" DataFormatString="<%$Resources:DateFormat %>">
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn UniqueName="Status" SortExpression="StatusId" HeaderText="<%$Resources:Status %>">
                                    <ItemTemplate>
                                        <asp:Label ID="lblStatus" runat="server" Text='<%#Eval("Status.Title") %>'> </asp:Label>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                            <EditFormSettings>
                                <EditColumn UniqueName="EditCommandColumn1">
                                </EditColumn>
                            </EditFormSettings>
                        </MasterTableView>
                    </telerik:RadGrid>

can you help me at this issue,
than you in advance


3 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 05 Aug 2009, 07:28 PM
Does your link bring you to another page that you then have to press back, or select the page again on the menu? Something like that could cause the grid to "forget" which order you sorted in. Also, when it "forgets" does it always end up sorting by the default sort settings? You could maybe be forcing a sorting order that takes precedence over the manual sorting you are doing within the grid.
0
rizk
Top achievements
Rank 1
answered on 06 Aug 2009, 09:07 AM
hi,
actually one of these links are delete button, so it simply deletes one row from the grid, no navigation to a nother page happened.
the current scenario is when i click at this link button, the grid forgets the sorting order and end up by the default sort settings.
0
Schlurk
Top achievements
Rank 2
answered on 06 Aug 2009, 01:18 PM
I'd say take a look at this demo: http://demos.telerik.com/aspnet-ajax/grid/examples/client/clientdelete/defaultcs.aspx. Here you can delete and even do a post-back and the sorting order remains the same, which is what you are looking for right? Hopefully this helps!
Tags
Grid
Asked by
rizk
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
rizk
Top achievements
Rank 1
Share this question
or