Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > RadGrid with dynamic DataSource

Not answered RadGrid with dynamic DataSource

Feed from this thread
  • Douglas avatar

    Posted on Feb 21, 2012 (permalink)

    I have a RadGrid that needs to have dynamic DataSource. The grid will have an A to Z index, where only names started by selected alphabeth is displayed.

    When the grid is first loaded, the datasource is by default:

    <asp:LinqDataSource ID="ldsMember" ContextTypeName="RedBuckDataContext" TableName="RB_Members" OrderBy="FIFOType" runat="server" />

    It loads fine, I can edit, insert and delete columns with no problems.

    When an A-Z linkbutton is clicked, the grid's datasource is changed:

                    using (RedBuckDataContext rbdc = new RedBuckDataContext())
                    {
                        var member = (from m in rbdc.RB_Members
                                      where m.Name.StartsWith(lbAlp.CommandArgument)
                                      select m);

                        rgMember.DataSource = member.ToList();
                    }

            rgMember.DataSourceID = null;
            rgMember.DataBind();

    The grid displays only data starated with the selected alphabeth, which is good!

    The problem is, when I click "Edit" to modify the data, the grid does not display anything. The rows displayed were gone. It is like the datasource has been resetted.

    Can anyone please help me on this?

    Cheers,

    Andry

    Reply

  • Tsvetina Tsvetina admin's avatar

    Posted on Feb 23, 2012 (permalink)

    Hi Douglas,

    Please note that when using simple data-binding you need to assign the data source and rebind the grid after any data operation such as paging, sorting, editing, and so on.

    As a different option, you can cosider switching to using advanced data-binding to have this rebinding handled by the RadGrid control implicitly:
    http://www.telerik.com/help/aspnet-ajax/grid-advanced-data-binding.html

    Regards,
    Tsvetina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > RadGrid with dynamic DataSource
Related resources for "RadGrid with dynamic DataSource"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]