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

RadGrid inside RadListView problem..

3 Answers 145 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Carlo
Top achievements
Rank 1
Carlo asked on 22 Oct 2010, 12:57 AM
Hi,

I have a RadGrid inside a RadListView (which has a page size of 1), the problem I'm having is that my RadGrid_OnNeedDataSource gets called before my RadListView_OnNeedDataSource. This is problematic because the data I need to populate my RadGrid with is dependent on the
RadListView's new DataKey: ideally in RadGrid_OnNeedDataSource I'd get the NEW DataKeyValue of the RadListView and use that to
call a stored procedure in the database.

If I try to get the RadListView's current item's datakey in RadGrid_OnNeedDataSource I always get the old RadListView item's datakey (i.e. not the one I just selected).

Is there an easy work around for this?

Regards,
-Carlo

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 25 Oct 2010, 03:32 PM
Hello Carlo,

It seems to be working properly on my end. For your convenience I am attaching sample page that replicates similar scenario. Please give it a try.

All the best,
Nikolay
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
Carlo
Top achievements
Rank 1
answered on 25 Oct 2010, 04:55 PM
Hi Nikolay,

You example only has a RadGrid_NeedDataSource, my case the RadListView also has a RadListView_NeedDataSource (i.e. I have two NeedDataSource routines RadGrid_NeedDataSource and RadListView_NeedDataSource.

The RadGrid is in the itemtemplate of the RadListView, and for each displayed item:

First RadGrid_NeedDataSource gets called
Then RadListView_NeedDataSource gets called

This results that in RadGrid_NeedDataSource you cannot get access to the new RadListView datakey (it's still the old one)

Regards,
-Carlo
0
Nikolay Rusev
Telerik team
answered on 28 Oct 2010, 08:55 AM
Hello Carlo,

RadListView on the page is also binded via NeedDataSource:

protected void Page_Init(object sender, EventArgs e)
   {
       RLV.NeedDataSource+=(s,args)=>
       {
           RLV.DataSource = Enumerable.Range(0, 10).Select(i => new { Data = i });
       };        
   }


Best wishes,
Nikolay
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
ListView
Asked by
Carlo
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Carlo
Top achievements
Rank 1
Share this question
or