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

RadGrid Search Functionality

1 Answer 276 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mayur
Top achievements
Rank 1
Mayur asked on 23 May 2014, 12:39 PM
I have a rad-grid with search functionality,in which i have a Important Level Column that has Very Low and Low records .So when i search low ideally very low should come first as it should appear in same sequence that was before search , but Low Comes First. Here i have attached gif for more details.


Please Suggest.



1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 May 2014, 08:55 AM
Hi Mayur,

I guess you are trying to filter the Grid with the search result. The result will be displayed in the order of display, it wont change during filter. Below is a sample code snippet, please try and check if the issue exist. Please provide your full code snippet if this doesn't help.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true" OnNeedDataSource="RadGrid1_NeedDataSource">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" ShowFilterIcon="false" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" />
            <telerik:GridBoundColumn DataField="Status" HeaderText="Status" UniqueName="Status" ShowFilterIcon="false" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" />
            <telerik:GridBoundColumn DataField="Number" HeaderText="Number" UniqueName="Number" ShowFilterIcon="false" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    dynamic data = new[] {
  new { ID = 1, Status = "Low", Number=123},
  new { ID = 2, Status = "Very Low", Number=234},
  new { ID = 3, Status = "Low", Number=234},
  new { ID = 4, Status = "High", Number=456},
  new { ID = 5, Status = "Very Low", Number=567},
  new { ID = 6, Status = "High", Number=567},
  new { ID = 7, Status = "Low", Number=789},
  new { ID = 8, Status = "High", Number=896},
  new { ID = 9, Status = "Very Low", Number=741}
  };
    RadGrid1.DataSource = data;
}

Thanks,
Princy
Tags
Grid
Asked by
Mayur
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or