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
55
WebHierarchicalGrid Databinding Problem
posted

I used the following code for binding.

I got nothing.

No error/exception. No Result.

-----------------------------------------------------------------------------------------------------------------------------------------------------

   protected void LoadData()
    {
        SqlDataSource sdsParent = new SqlDataSource();
        sdsParent.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
        sdsParent.SelectCommand = "SELECT TM.TXN_NO AS TXN_NO, TM.FPSHOP_NO, TM.CARD_NO, FD.MEMBERNAME AS MEMBERNAME,FD.UID_NUMBER, TM.TOT_AMOUNT, TO_CHAR(TM.TXN_DATETIME, 'DD-MM-YYYY HH:MI:SS') AS EXPR1, DM.DIST_NAME, MM.MAND_NAME, TM.DEVICE_TXN_NO FROM TRANSACTION_MASTER TM, DIST_MST DM, MAND_MST MM, HH_FAMILYDETAILS FD WHERE DM.DIST_NO = TM.DIST_NO AND MM.MAND_NO = TM.MAND_NO AND MM.DIST_NO = TM.DIST_NO AND FD.HOUSEHOLDCARDNO = TM.CARD_NO AND FD.SLNO = TM.MEMBER_ID ORDER BY TM.TXN_DATETIME DESC";
        sdsParent.DataBind();

        SqlDataSource sdsChild = new SqlDataSource();
        sdsChild.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
        sdsChild.SelectCommand = "SELECT TXN_NO,COMMODITY_NAME,QTY,TD.PRICE FROM TRANSACTION_DETAILS TD INNER JOIN COMMODITY_MASTER CM ON TD.COMMODITY_CODE=CM.COMMODITY_CODE";
        sdsChild.DataBind();

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

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

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

        hdsMain.DataRelations.Add(drMain);



        WebHierarchicalDataGrid1.DataSource = hdsMain;
        WebHierarchicalDataGrid1.DataKeyFields = "TXN_NO";

        Band b1 = new Band();
        b1.DataMember = "TXN_NO";
        b1.DataKeyFields = "TXN_NO";

        WebHierarchicalDataGrid1.Bands.Add(b1);

        WebHierarchicalDataGrid1.DataBind();

   
    }

Parents
No Data
Reply Children
No Data