RadGrid inside RadListView problem..

4 posts, 0 answers
  1. Carlo
    Carlo avatar
    6 posts
    Member since:
    Oct 2010

    Posted 21 Oct 2010 Link to this post

    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
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 25 Oct 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Carlo
    Carlo avatar
    6 posts
    Member since:
    Oct 2010

    Posted 25 Oct 2010 Link to this post

    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
  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 28 Oct 2010 Link to this post

    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
Back to Top