Hi, i have a management problem,
i have a grid that have a query as datasource, grid is enabled to filter and paging, when i filter, it filter for all pages,
so the result is:
Page1 - result
Page2 - result etc etc
i want the it filtering for all the pages and then refresh the number of pages;
Now post some code because mi english is bad:
thank you.
<telerik:RadScriptManager runat="server" ID="Scipr"></telerik:RadScriptManager> |
<telerik:RadGrid runat="server" ID="rgrProva" Skin="Hay" |
AutoGenerateColumns="false" AllowFilteringByColumn="true" |
onpageindexchanged="rgrProva_PageIndexChanged" EnableLinqExpressions="false" |
onneeddatasource="rgrProva_NeedDataSource" > |
<PagerStyle Mode="NumericPages" /> |
<ClientSettings> |
<Selecting AllowRowSelect="true"/> |
</ClientSettings> |
<MasterTableView> |
<Columns> |
<telerik:GridNumericColumn UniqueName="colAnno" DataField="RIC.reqann"> |
</telerik:GridNumericColumn> |
<telerik:GridNumericColumn UniqueName="colNumero" DataField="RIC.reqnum" FilterControlWidth="40px" |
AutoPostBackOnFilter="false" CurrentFilterFunction="Contains" FilterDelay="4000" ShowFilterIcon="false"> |
</telerik:GridNumericColumn> |
<telerik:GridBoundColumn UniqueName="colCliente" DataField="RIC.reqcli"> |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
private void _Load(int PageNumber) |
{ |
rgrProva.AllowPaging = true; |
rgrProva.PageSize = 15; |
rgrProva.PagerStyle.Mode = GridPagerMode.NumericPages; |
rgrProva.AllowCustomPaging = true; |
FinitenessEntities context = new FinitenessEntities(); |
var qReq = from n in context.RICHIESTE |
orderby n.reqann, n.reqnum |
select new {RIC = n }; |
rgrProva.VirtualItemCount = qReq.Count(); |
rgrProva.DataSource = qReq.Skip(rgrProva.PageSize * PageNumber).Take(rgrProva.PageSize); |
} |
protected void rgrProva_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e) |
{ |
this._Load(e.NewPageIndex); |
} |
protected void rgrProva_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
this._Load(0); |
} |