ReBind - Not Firing NeedDataSource

4 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 04 Feb 2009 Link to this post

    Hello,

    My page binds data initially to the RadGrid, but then a change in something should cause the RadGrid to bind again.  I was calling the RadGrid's Rebind() method to bind again, but it's not firing NeedDataSource event...  why is that?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Feb 2009 Link to this post

    Hi Brian,

    Are you binding the Grid using DataSourceID or setting the DataSource in the code behind ? Rebind will be firing NeedDataSource event if the databinding logic for the Grid is placed inside this event.

    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 05 Feb 2009 Link to this post

    Hey,

    DataSource from the code-behind.  It seems as if I have to set:

    RadGrid1.DataSource = null;
    RadGrid1.Rebind();

    To rebind the grid; otherwise, NeedDataSource doesn't fire.  And I do bind in Rebind.
  5. -DJ-
    -DJ- avatar
    263 posts
    Member since:
    Oct 2004

    Posted 16 Feb 2009 Link to this post

    I'm facing a similar problem. Rebind seems to fire or not fire at will.

    I have a grid bound in the needdatasource event. I can then filter the grid using a treeview in a combobox, call the rebind where the select string is then changed. This works fine.

    I then have a button which clears the tree (clear filter) and calls rebind, but in this case nothing happens.

    RadGrid1.DataSource = Nothing - works as you said Brian, thanks.

    Regards,
    -DJ-
Back to Top