Hi,
In my application I want to display simple grid with paging and filtering functionality. I am using custom paging for pagination of the grid.
My NeedDataSoure look like this
protected void rgList_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
Meeting360Entities db = new Meeting360Entities();
var query = from c in db.Committees
select c;
var Data = query.ToList();
rgList.DataSource = Data.Skip(rgList.CurrentPageIndex * rgList.PageSize).Take(rgList.PageSize); // This line will selects records need to display on screen.
rgList.VirtualItemCount = Data.Count;
}
Like my above code in want select filtered data from data base. So how can in add WHERE clause into my linq query.
<telerik:RadGrid ID="rgList" runat="server" AutoGenerateColumns="false" OnItemCommand="rgList_ItemCommand" GridLines="None"
ClientSettings-EnableRowHoverStyle="true" PagerStyle-Position="Bottom" AllowPaging="True" AllowCustomPaging ="true" PageSize="10" OnNeedDataSource="rgList_NeedDataSource"
AllowFilteringByColumn="true">
<MasterTableView DataKeyNames="CommitteeID" ClientDataKeyNames="CommitteeID">
<Columns>
<telerik:GridBoundColumn DataField="CommitteeID" HeaderText="CommitteeID" UniqueName="CommitteeID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" UniqueName="Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn>
<ItemTemplate>
<telerik:RadButton ID="btnEdit" runat="server" CommandArgument='<% #Eval("CommitteeID")%>' CommandName="ItemEdit" Text="Edit"></telerik:RadButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true"></Selecting>
</ClientSettings>
</telerik:RadGrid>