datalist嵌套

使用saldatasource可以做到,选择里面的control参数。



例子:

   <div>
    
        <asp:DataList ID="dlZBInfo" runat="server" DataKeyField="goo_Code"
            DataSourceID="SqlDataSource1"
            onselectedindexchanged="DataList1_SelectedIndexChanged" CellPadding="4"
            ForeColor="#333333">
            <AlternatingItemStyle BackColor="White" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <ItemStyle BackColor="#E3EAEB" />
            <ItemTemplate>
                <asp:Label ID="men_IDLabel" runat="server" Text='<%# Eval("men_ID") %>'
                    Visible="False" />
                <asp:DataList ID="dlZBMC" runat="server" DataKeyField="men_ID"
                    DataSourceID="SqlDataSource_Menu">
                    <ItemTemplate>                                 
                        <asp:Label ID="men_NameLabel" runat="server" Text='<%# Eval("men_Name") %>' />
                    </ItemTemplate>

                </asp:DataList>
                <asp:SqlDataSource ID="SqlDataSource_Menu" runat="server"
                    ConnectionString="<%$ ConnectionStrings:tlzbglConnectionString %>"
                    SelectCommand="SELECT * FROM [tbl_CatalogMenu] WHERE ([men_ID] = @men_ID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="men_IDLabel" Name="men_ID" PropertyName="Text"
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <br />
                品牌:
                <asp:Label ID="goo_BrandLabel" runat="server" Text='<%# Eval("goo_Brand") %>' />
                <br />
                技术参数:
                <asp:Label ID="goo_SpecLabel" runat="server" Text='<%# Eval("goo_Spec") %>' />
                <br />
               供应商:
                <asp:Label ID="goo_SupplierLabel" runat="server"
                    Text='<%# Eval("goo_Supplier") %>' />
                <br />
              价格:
                <asp:Label ID="goo_AcUnPriceLabel" runat="server"
                    Text='<%# Eval("goo_AcUnPrice") %>' />
                <br />
               学校:
                <asp:Label ID="sch_CodeLabel" runat="server" Text='<%# Eval("sch_Code") %>' Visible="False" />
                <asp:DataList ID="dlXuexiao" runat="server" DataSourceID="SqlDataSource_School">
                    <ItemTemplate>
                     
                        <asp:Label ID="sch_NameLabel" runat="server" Text='<%# Eval("sch_Name") %>' />
                
                    </ItemTemplate>
                </asp:DataList>
                <asp:SqlDataSource ID="SqlDataSource_School" runat="server"
                    ConnectionString="<%$ ConnectionStrings:tlzbglConnectionString %>"
                    SelectCommand="SELECT [sch_Name] FROM [tbl_School] WHERE ([sch_Code] = @sch_Code)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="sch_CodeLabel" Name="sch_Code"
                            PropertyName="Text" Type="Decimal" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <br />
                验收合格日期:
                <asp:Label ID="goo_AcDateLabel" runat="server"
                    Text='<%# Eval("goo_AcDate") %>' />
                <br />
               保修截止日期:
                <asp:Label ID="goo_ExDateLabel" runat="server"
                    Text='<%# Eval("goo_ExDate") %>' />
                <br />
                报修电话:
                <asp:Label ID="goo_ASPLabel" runat="server" Text='<%# Eval("goo_ASP") %>' />
                <br />
                所属采购项目批次:
                <asp:Label ID="pro_IDLabel" runat="server" Text='<%# Eval("pro_ID") %>'
                    Visible="False" />
                <asp:DataList ID="DataList1" runat="server"
                    DataSourceID="SqlDataSource_Project">
                    <ItemTemplate>
                    <asp:Label ID="pro_NameLabel" runat="server" Text='<%# Eval("pro_Name") %>' />
                 
                    </ItemTemplate>
                </asp:DataList>
                <asp:SqlDataSource ID="SqlDataSource_Project" runat="server"
                    ConnectionString="<%$ ConnectionStrings:tlzbglConnectionString %>"
                    SelectCommand="SELECT [pro_Name] FROM [tbl_ProcurementProject] WHERE ([pro_ID] = @pro_ID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="pro_IDLabel" Name="pro_ID" PropertyName="Text"
                            Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <br />
                使用人:
                <asp:Label ID="goo_UserLabel" runat="server" Text='<%# Eval("goo_User") %>' />
                <br />
                使用场景:
                <asp:Label ID="goo_SituationLabel" runat="server"
                    Text='<%# Eval("goo_Situation") %>' />
                <br />
<br />
            </ItemTemplate>
            <SelectedItemStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        </asp:DataList>
    
    </div>
     <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:tlzbglConnectionString %>"
        SelectCommand="SELECT * FROM [tbl_Goods] WHERE ([goo_Code] = @goo_Code2)">
         <SelectParameters>
             <asp:QueryStringParameter DefaultValue="2016baiban162-103" Name="goo_Code2"
                 QueryStringField="id" Type="String" />
         </SelectParameters>
    </asp:SqlDataSource>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值