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

Dynamic Rad Grid pagenation is not working

1 Answer 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mani
Top achievements
Rank 1
mani asked on 12 Feb 2010, 02:34 PM

Hi
     I tried to implement the Dynamic Rad Grid Creation through code behind(Telerik version Q3 2009 Sp2). The Control is working fine and datas are showing in the grid in More then 200 records.  So i set the page size is 25 in rad grid. When Click the Second Link the Data are are Disappear. The grid was gone . Let me know how can i fix the Rad grid dynamic pagenation issue. herewith i have send the sample code and sample print screen.

//Global Declaration

OrderManager orderManager = new OrderManager();

protected void Page_Load(object sender, EventArgs e)
{
  RadGrid Grid = (RadGrid)pnlReservationGrid.FindControl("OrderGrid");

            if (Grid != null)
            {
                AjaxDynamicReport.AjaxSettings.AddAjaxSetting(Grid, Grid);
            }
}

 

//Page Load
 protected void Page_Init(object sender, System.EventArgs e)
        {
            OrderGrid.ID = "OrderGrid";          
           OrderCheckinDateReport();
            OrderGrid.AllowPaging = true;
        }

 

  public void OrderCheckinDateReport()
        {
            List<OrderData> aOrderDataList = new List<OrderData>();

            fromDate = (Convert.ToDateTime(locateReservationStartDatePicker.SelectedDate));

            if (locateReservationStartDatePicker.SelectedDate != null && locateReservationLastDatePicker.SelectedDate != null)
            {
                toDate = (Convert.ToDateTime(locateReservationLastDatePicker.SelectedDate));
            }
            if (locateReservationStartDatePicker.SelectedDate != null && locateReservationLastDatePicker.SelectedDate == null)
            {
                toDate = toDate = fromDate.AddDays(30);
            }

            aOrderDataList = orderManager.GetRentalAgreementNotAgreedByCheckInDate(fromDate, toDate);
           
            OrderGrid.AllowPaging = true;
            OrderGrid.PageSize = 25;
            OrderGrid.DataSource = aOrderDataList;
            OrderGrid.AlternatingItemStyle.BackColor = Color.LightGray;
            OrderGrid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            OrderGrid.Width = Unit.Percentage(98);
            OrderGrid.AllowSorting = false;
            OrderGrid.AutoGenerateColumns = false;
            GridBoundColumn boundColumn;

            List<OrderReportData> aOrderReportDataList = new List<OrderReportData>();
            aOrderReportDataList = orderManager.OrderReportColumn();

            foreach (OrderReportData aOrderReportData in aOrderReportDataList)
            {
                boundColumn = new GridBoundColumn();
                boundColumn.DataField = aOrderReportData.DTOName;
                boundColumn.HeaderText = aOrderReportData.DisplayName;
                boundColumn.HeaderStyle.Width = aOrderReportData.CellHeight;
                OrderGrid.MasterTableView.Columns.Add(boundColumn);
            }

            OrderGrid.DataBind();
            pnlReservationGrid.Controls.Add(OrderGrid);

        }

Aspx page
<div class="updaterategroupshistorypnl" style="clear:both;"  >
     <asp:Panel ID="pnlReservationGrid" runat="server" GroupingText="<%$ Resources:AdminResource,pnlRateHistory%>">
       
     </asp:Panel>
 </div>
 <JetSoft:RadAjaxManager ID="AjaxDynamicReport" runat="server">
            </JetSoft:RadAjaxManager>

 

 

 

public void Display_Click(object sender, EventArgs e)

 

{

OrderCheckinDateReport();
}

 


Thanks
G. Manikandan
 

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 16 Feb 2010, 12:58 PM
Hi Mani,

Instead of binding the grid conditionally using simple binding with DataBind() calls, you can transform your code to take advantage of the advanced binding with NeedDataSource handling. Please give this suggestion a try and see whether this addresses the issue

Regards,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
mani
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or