Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
124
How to force WHDG to refresh from datasource?
posted

Hi,

My Web Hierarchical Data Source, WHDS, is from two SQL datatables and defined entirely in C#.  I'm using .NET 2.0.

Does anyone know how to force the WHDG to refresh/reload when I want, on a postback?  I'm changing the database from the page, adding and removing rows, but I can't figure out how to get the WHDG to reload and show current data.  All of my inserts/deletes are outside the grid: no direct editing is being done.

Any assistance would be terrific!  Thx.

Charles

  • 124
    Verified Answer
    posted

           // in a method that I call in page_load and selectively on a postback

           // ... just reloaded my two datatables from SQL stored procedures

           // Declare the datatables as the datasources of the parent and child dataviews of my WHDS
            myWebHierarchicalDataSource.DataViews.FindByID("parent").DataSource = myDataTable;
            myWebHierarchicalDataSource.DataViews.FindByID("child").DataSource = myDataTable2;

            // Now force a rebind of my WHDG
            this.myWHDG.Rows.Clear();
            this.myWHDG.DataBind();