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

[Solved] Using NextPrevNumericAndAdvanced Pager in Master table and Detail table

3 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tatiana
Top achievements
Rank 2
Tatiana asked on 10 Apr 2009, 08:20 PM

I use RadGrid control version 4.6.

 

I want to use NextPrevNumericAndAdvanced Pager for my grid to be able to manipulate the size of the master and detail tables. I can resize the master table. Unfortunately, when I resize the master table, the dimensions of the detail table are also changed. It is not the behavior I need. I need both of the table view to work completely separately.

 

Another problem I have is when I try to change the size of detail table; I’m getting the following exception:

 

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]

   Telerik.WebControls.GridPageSizeChangedEventArgs.ExecuteCommand(Object source) +18 
   Telerik.WebControls.RadGrid.OnBubbleEvent(Object source, EventArgs e) +134 
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
   Telerik.WebControls.GridItem.OnBubbleEvent(Object source, EventArgs e) +38 
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
   Telerik.WebControls.GridTableView.set_PageSize(Int32 value) +176 
   Telerik.WebControls.GridPageChangedEventArgs.ExecuteCommand(Object source) +722 
  
[GridException: The specified value cannot be set on PageSize] 
   Telerik.WebControls.GridPageChangedEventArgs.ExecuteCommand(Object source) +822 
   Telerik.WebControls.RadGrid.OnBubbleEvent(Object source, EventArgs e) +134 
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
   Telerik.WebControls.GridItem.OnBubbleEvent(Object source, EventArgs e) +38 
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
   Telerik.WebControls.GridItem.OnBubbleEvent(Object source, EventArgs e) +38 
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
   Telerik.WebControls.GridItem.OnBubbleEvent(Object source, EventArgs e) +115 
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118 
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135 
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082

 

Below you will find the sample code that you can use to reproduce the problems I described above.

 

Thank you very much in advance for all your help!!!

 

 

 

GridPager.aspx:

 

<%@ Page Language="C#" MasterPageFile="~/MasterPage/WWR.Master" AutoEventWireup="true"

         CodeBehind="GridPager.aspx.cs" Inherits="TestingStaff.GridPager" Title="Grid Pager" %>

 

<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>

 

<asp:Content ID="Content1" ContentPlaceHolderID="cp1" runat="server">

    <radG:RadGrid ID="rgSchedules" runat="server" Skin="Yellow" Width="100%" AllowPaging="true"

            OnNeedDataSource="rgSchedules_NeedDataSource">

        <MasterTableView Name="Master" DataKeyNames="ScheduleId">

            <Columns>

                <radG:GridBoundColumn DataField="ScheduleId" HeaderText="Schedule ID" UniqueName="ScheduleId" />

                <radG:GridBoundColumn DataField="ScheduleName" HeaderText="Schedule Name" UniqueName="ScheduleName" />

            </Columns>

            <DetailTables>

                <radG:GridTableView runat="server" Name="Detail" Width="100%" GridLines="Both">

                    <ParentTableRelation>

                        <radG:GridRelationFields DetailKeyField="ScheduleId" MasterKeyField="ScheduleId" />

                    </ParentTableRelation>

                    <Columns>

                        <radG:GridBoundColumn DataField="ClientId" HeaderText="Client ID" UniqueName="ClientNumber" />

                        <radG:GridBoundColumn DataField="ClientName" HeaderText="Client Name" UniqueName="ClientName" />

                        <radG:GridBoundColumn DataField="ScheduleId" UniqueName="ScheduleId" Visible="false" />

                    </Columns>

                </radG:GridTableView>

            </DetailTables>

        </MasterTableView>

        <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" />

    </radG:RadGrid>

</asp:Content>

 

 

 

GridPager.aspx.cs:

 

using System;

using System.Web.UI;

using System.Collections.Generic;

using Telerik.WebControls;

 

namespace TestingStaff

{

    public partial class GridPager : Page

    {

        private class Schedule

        {

            private int scheduleID;

            private string scheduleName;

            public int ScheduleID

            {

                get { return scheduleID; }

                set { scheduleID = value; }

            }

            public string ScheduleName

            {

                get { return scheduleName; }

                set { scheduleName = value; }

            }

        }

       

        private class Client

        {

            private int clientID;

            private string clientName;

            private int scheduleID;

            public int ClientID

            {

                get { return clientID; }

                set { clientID = value; }

            }

            public string ClientName

            {

                get { return clientName; }

                set { clientName = value; }

            }

            public int ScheduleID

            {

                get { return scheduleID; }

                set { scheduleID = value; }

            }

        }

       

        protected void rgSchedules_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

        {

            List<Schedule> schedules = new List<Schedule>();

            List<Client> clients = new List<Client>();

            for (int i = 1; i <= 2; i++)

            {

                Schedule schedule = new Schedule();

                schedule.ScheduleID = i;

                schedule.ScheduleName = "Schedule " + i.ToString();

                schedules.Add(schedule);

                for (int j = 1; j <= 10; j++)

                {

                    Client client = new Client();

                    client.ClientID = j;

                    client.ClientName = " Client " + j.ToString() + " of Schedule " + i.ToString();

                    client.ScheduleID = i;

                    clients.Add(client);

                }

            }

            rgSchedules.DataSource = schedules;

            rgSchedules.MasterTableView.DetailTables[0].DataSource = clients;

        }

    }

}

 

 

 

WWR.Master

 

<%@ Master Language="C#" AutoEventWireup="true" Codebehind="WWR.Master.cs" Inherits="TestingStaff.WWR" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

        <asp:ContentPlaceHolder ID="cp1" runat="server" />

    </form>

</body>

</html>

 

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 13 Apr 2009, 03:56 PM
Hello Tatiana,

I already replied to your question in the other forum thread you opened with regards to this subject:
http://www.telerik.com/community/forums/aspnet-ajax/grid/using-custom-pager-in-master-table-and-detail-table.aspx

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Tatiana
Top achievements
Rank 2
answered on 13 Apr 2009, 04:25 PM
Sebastian,

If you noticed in my code, instead of custom pager, I use the telerik's NextPrevNumericAndAdvanced Pager and have the same exception and, even more, exactly the same behaviour.

Regarding your suggestion to upgrade the latest version of the grid, my company is in the process of considering this in the future. However, I need this feature to work right now.

Thank you very much,
Tatiana
0
Sebastian
Telerik team
answered on 14 Apr 2009, 08:01 AM

Hello Tatiana,

Thank you for the information. Can you please upgrade to the latest ASP.NET version of RadGrid (5.16) to see whether this addresses the error in question? If the problem persists, the best means to progress in our investigation is to prepare a stripped working version of your project, exhibiting the issue, and send it enclosed to a regular support ticket. We will test/debug it locally and will advice you further.

In addition, you may contact your employee to add you as a licensed developer to the purchase he/she made. Thus you will be able to take advantage of the support package available with the corresponding license:

http://www.telerik.com/support/technical-support-options.aspx

Kind regards,

Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Tatiana
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
Tatiana
Top achievements
Rank 2
Share this question
or