Good day Guys,
I have two radgrids on the same page one works perfectly fine with paging and datasource bindings.
The second grid works with the filtering of raddatepickers. So a user has to filer certain data using the datepickers eg. from "date" to "date". Please note that the datepickers are not inside the grid but outside. i also have a button which is used as click event after the user selecting dates
please see below code client side markup of the second grid which has a problem with the paging
and also the code behind for filtering and and binding to the grid. Im using linq to Sql
protected void btnfilter_Click(object sender, EventArgs e) { DateTime From = Convert.ToDateTime(RadDatePicker1.SelectedDate); DateTime To = Convert.ToDateTime(RadDatePicker2.SelectedDate); //rgApprovedTransactionsLists.MasterTableView.Rebind(); var AprrovedTrans = (from s in db.OneTimePins join t in db.TransactionTypes on s.TransactionTypeID equals t.TransactionTypeID join userapp in db.Users on s.ApprovedBy equals userapp.UserID where (s.ApprovedDate >= From && s.ApprovedDate < To) select new { s.OneTimePinID, t.TransactionType1, s.PIN, s.Amount, s.WithdrawerID, s.WithdrawDate, s.ApprovedDate, s.CancellationDate, ApprovedBy = userapp.FirstName + " " + userapp.LastName }); rgApprovedTransactionsLists.DataSource = AprrovedTrans.ToList(); rgApprovedTransactionsLists.DataBind(); }<div> <asp:Label ID="lblMessagefilter" runat="server" ></asp:Label> </div> <table> <tr> <td align="center" style="width:50%;"> <telerik:RadLabel ID="RadLabel1" Text="From :" runat="server"> </telerik:RadLabel> <telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1" DateInput-DateFormat="dd-MM-yyyy" runat="server"> </telerik:RadDatePicker> </td> <td align="center" class="auto-style1"> <telerik:RadLabel ID="RadLabel2" Text="To :" runat="server"> </telerik:RadLabel> <telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2" DateInput-DateFormat="dd-MM-yyyy" runat="server"> </telerik:RadDatePicker> <telerik:RadButton ID="RadButton1" runat="server" Text="filter" OnClick="btnfilter_Click" Width="100px"> </telerik:RadButton> </td> </tr> </table> - <table width="700px"> <tr> <td> <br /> </td> </tr> <tr> <td> <telerik:RadGrid ID="rgApprovedTransactionsLists" runat="server" AllowPaging="true" PagerStyle-AlwaysVisible="true" EnableViewState="true" PageSize="10" AllowSorting="true" OnPageIndexChanged="rgApprovedTransactionsLists_PageIndexChanged" OnPageSizeChanged="rgApprovedTransactionsLists_PageSizeChanged" OnNeedDataSource="rgApprovedTransactionsLists_NeedDataSource" Width="1113px" AutoGenerateColumns="False" > <MasterTableView DataKeyNames="OneTimePinID" TableLayout ="Fixed" FilterItemStyle-BorderStyle="NotSet" MultiHeaderItemStyle-VerticalAlign="NotSet" > <Columns> <telerik:GridBoundColumn Visible="false" DataField="OneTimePinID" HeaderText="OneTimePinID" AllowSorting="true" > <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="TransactionType1" HeaderText="TransactionType" AllowSorting="true" > <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="PIN" HeaderText="One Time Pin" AllowSorting="true"> <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Amount" HeaderText="Amount" > <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="WithdrawerID" HeaderText="WithdrawerID" AllowSorting="true"> <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="WithdrawDate" HeaderText="Withdraw Date" AllowSorting="true"> <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center"/> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ApprovedDate" HeaderText="Approved Date" AllowSorting="true"> <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center"/> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CancellationDate" HeaderText="Cancellation Date" AllowSorting="true"> <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center"/> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ApprovedBy" HeaderText="Approved By" AllowSorting="true"> <HeaderStyle Width="100px" HorizontalAlign="Center" Font-Bold="true"/> <ItemStyle HorizontalAlign="Center"/> </telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid> </td> </tr> </table>
Help anyone will be appreciated
kind regards
Marc
