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
50
On expand row Data Binding manually
posted

hi

following is my requirement 

  i  want to only pull from the server expanded information when a row is expanded.  If the row is collapsed then we needed load that information until it is needed.

 

this is my code which is using to bind the web hierarchical data grid

//parent
       
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["pubsConnectionString"].ToString());
        SqlDataAdapter adp = new SqlDataAdapter("SELECT [au_id], [au_lname], [au_fname], [phone], [address], [city], [state], [zip], [contract] FROM [authors]", con);
        DataSet ds = new DataSet();
        adp.Fill(ds);


        //child

        SqlDataAdapter adp1 = new SqlDataAdapter("SELECT [au_id], [au_ord], [title_id], [royaltyper] FROM [titleauthor]", con);
        DataSet ds1 = new DataSet();
        adp1.Fill(ds1);


        Infragistics.Web.UI.DataSourceControls.DataView dvParent = new Infragistics.Web.UI.DataSourceControls.DataView();
        dvParent.ID = "PARENT";
        dvParent.DataSource = ds;

        Infragistics.Web.UI.DataSourceControls.DataView dvChild = new Infragistics.Web.UI.DataSourceControls.DataView();
        dvChild.ID = "CHILD";
        dvChild.DataSource = ds1;

        WebHierarchicalDataSource hdsMain = new WebHierarchicalDataSource();

        //Adding views to WebHierarchicalDataSource
        hdsMain.DataViews.Add(dvParent);
        hdsMain.DataViews.Add(dvChild);

        //Defining relation.

        Infragistics.Web.UI.DataSourceControls.DataRelation drMain = new Infragistics.Web.UI.DataSourceControls.DataRelation();
        drMain.ParentDataViewID = "PARENT";
        drMain.ChildDataViewID = "CHILD";
        drMain.ParentColumns = new string[] { "au_id" };
        drMain.ChildColumns = new string[] { "au_id" };
        hdsMain.DataRelations.Add(drMain);

        WHG.DataKeyFields = "au_id";
        WHG.DataSource = hdsMain;
        WHG.DataBind();

please provide me sample code for the above requirement if it is possible


thanks

srikanth