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
935
How to Link Child with sqlparameters from Parent Row Data
posted

Hello i have this problem about WHDG which make my development freeze .

I have a Header Sqldatasource

 

 <asp:SqlDataSource ID="sqldsourceHeader" runat="server" 

        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 

        SelectCommand="ParentRead" 

        SelectCommandType="StoredProcedure">

    </asp:SqlDataSource>

 

which retrieve this following Table:

ID  | P/N | DATE | LOC     

 

And the ChildSqlDatasource

 

       <asp:SqlDataSource ID="sqlDsourceDetail" runat="server" 

        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 

        SelectCommand="Select * from Child where P/N=@P/N AND LOC=@LOC AND DATE>@DATE">

           <SelectParameters>

               <asp:Parameter Name="P/N" />

               <asp:Parameter Name="LOC" />

               <asp:Parameter Name="DATE" />

           </SelectParameters>

    </asp:SqlDataSource>

 

which i need to get the Parameters from Parent . 

I  Relate my sqldatasource with WGDDataSource But it failed to Load the childBand

 

       <ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server">

           <DataRelations>

               <ig:DataRelation ChildColumns="P/N,LOC,DATE" 

                   ChildDataViewID="sqlDsourceDetail_DefaultView" 

                   ParentColumns="P/N,LOC,DATE" 

                   ParentDataViewID="sqldsourceHeader_DefaultView" />

           </DataRelations>

           <DataViews>

               <ig:DataView ID="sqldsourceHeader_DefaultView" DataMember="DefaultView" 

                   DataSourceID="sqldsourceHeader" />

               <ig:DataView ID="sqlDsourceDetail_DefaultView" DataMember="DefaultView" 

                   DataSourceID="sqlDsourceDetail" />

           </DataViews>

    </ig:WebHierarchicalDataSource>

 

Sample Output:

ID  | P/N | DATE          | LOC 

1       A       7/7/2011      TEST   

        P/N  | DATE          | LOC   (Child)     

         A        7/7/2011     TEST   

         A        7/7/2011     TEST

 

2       B       7/7/2011      TEST2  

        P/N  | DATE          | LOC   (Child)     

         B       7/7/2011     TEST2   

         B      7/7/2011     TEST2

 

 

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

After That  i need to loop through Parent and child band in server side code c#

foreach (Containergridrow parent on WHDG.Rows)

{

        foreach(//How can i get the child Rows)

                      {

                       }

I really need help .

Thanks in Regards

 

Parents
No Data
Reply Children
No Data