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

Grid Inside Nested View and it's Paging

5 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sergey Sugak
Top achievements
Rank 1
Sergey Sugak asked on 01 Jun 2010, 12:55 PM
Hello, guys.
I have problem similar to described here http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-inside-nestedviewtemplate-of-another-dynamic-radgrid.aspx
But somehow doing things the same way I don't get the same result.
Here is what my logic is:
I have SelectableItems grid.
In the nested view I have ItemLots grid where I would like to show some information to user.
I have following grdSelectableItems_ItemCommand event hadler

    protected void grdSelectableItems_ItemCommand(object source, GridCommandEventArgs e)
    {
        GridDataItem Row = e.Item as GridDataItem;
        if (Row != null)
        {
            if (e.CommandName == RadGrid.ExpandCollapseCommandName)
            {
                if (!Row.Expanded)
                    ExpandNestedView (Row);
            }
        }
    }

ExpandNestedView is the proecedure where I have the follwing peace of code
...
        GridNestedViewItem NestedView = ParentGridRow.ChildItem;
...
                RadGrid grdItemLots = (RadGrid)NestedView.FindControl("grdItemLots");
                if (grdItemLots != null)
                {
                    grdItemLots.NeedDataSource += new GridNeedDataSourceEventHandler(grdItemLots_NeedDataSource);
                    grdItemLots.Rebind();
                }
...

grdItemLots_NeedDataSource procedure fills the datasource and assigns it to grdItemLots.DataSource.
grdItemLots has AllowPaging="True"

And also  I wrote this little thing hoping that this will update grid's content after my actions with it.
    protected void grdItemLots_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridNestedViewItem NestedView = (GridNestedViewItem)((sender as RadGrid).NamingContainer);
            if (NestedView != null)
            {
                RadGrid grdItemLots = (RadGrid)NestedView.FindControl("grdItemLots");
                if (grdItemLots != null)
                    RadAjaxManager1.AjaxSettings.AddAjaxSetting(grdItemLots, grdItemLots);
            }
        }
    }

So the show begins when I try to go to the page different from #1 after expanding parent row. grdItemLots dissapears. BUT ! When I collapse and then expand the parent row I can see the data from the page 2.
What did I do wrong?

With respect, Sergey.
P.S. I'm using trial version 2010.1.519.40

5 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 04 Jun 2010, 12:11 PM
Hello Sergey Sugak,

I have created a small sample project that demonstrates how to achieve the desired functionality. Please give it a try and let me know how it goes on your side.

Regards,
Martin
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.
0
Batoha
Top achievements
Rank 1
answered on 08 Jun 2010, 02:37 PM
Hello, Martin.
I apprciate you wasted your time trying to help me.
I didn't install all .NET assemblies of RadControls (only 4.0) and unfortunately I have no much time to reconfigure your code at the moment. Could you tell me what could be the reason of the behaviour I explained. I don' t create any grid programmatically. Every event is handled. It seems that everything should work perfectly. But it doesn't.

Thanks in advance.
With respect, Sergey.
0
Martin
Telerik team
answered on 08 Jun 2010, 05:08 PM
Hello Sergey,

The main differences I have implemented in my sample project are as follows:
  • the inner grid's NeedDataSource event is wired on the ItemCreated event of the parent grid.
  • the inner grid is bound on the ItemCommand event of the parent one.
  • the inner grid is added to the RadAjaxManager's settings on the Page.PreRender event.
I have also attached a modified version of the project that should be runnable with .NET 4.0 assemblies. Just open it as a website, create a local Bin folder and place the "Telerik.Web.UI.dll" and "Telerik.Web.Design.dll" assemblies in it. Then you should be able to run the project without any problems.

Regards,
Martin
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.
0
Wired_Nerve
Top achievements
Rank 2
answered on 01 Jul 2010, 10:49 PM
I am dealing with a legacy page written in VB.NET and was wondering if you have this example in VB?


Warren
0
Martin
Telerik team
answered on 02 Jul 2010, 05:31 PM
Hello Warren,

I have attached a modified version of the project written both in C# and VB. Please also note that you can use the free Telerik code converter.

I hope this helps

Regards,
Martin
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
Sergey Sugak
Top achievements
Rank 1
Answers by
Martin
Telerik team
Batoha
Top achievements
Rank 1
Wired_Nerve
Top achievements
Rank 2
Share this question
or