我正在使用名为ARTICLE和COLOR的2列创建gridview。但我的问题是文章是颜色的参数。但我不知道如何使它成为参数。
的.aspx:
<asp:GridView ID="dgvIMF" runat="server" AutoGenerateColumns="False"
onrowcommand="dgvIMF_RowCommand" onrowdatabound="dgvIMF_RowDataBound"
DataKeyNames="ArtNo">
<Columns>
<asp:TemplateField HeaderText="Article">
<ItemTemplate>
<asp:DropDownList ID="ddlArt" runat="server" DataTextField="ArticleNo" DataValueField="ArticleNo" DataSourceID="SqlDataSource1">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Color">
<ItemTemplate>
<asp:DropDownList ID="ddlColor" runat="server" DataTextField="Description" DataValueField="Description" DataSourceID="SqlDataSource2">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:aspnetdbConnectionString %>"
SelectCommand="SELECT DISTINCT SUBDETAILS.Description FROM PRICESIZESET INNER JOIN SIZESET ON PRICESIZESET.SizePriceID = SIZESET.SizeSetID INNER JOIN ARTICLE AS ARTICLE ON ARTICLE.ControlNo = PRICESIZESET.ControlNo INNER JOIN ARTICLEFABRICASSIGN AS ARTICLEFABRICASSIGN ON ARTICLEFABRICASSIGN.ControlNo = ARTICLE.ControlNo INNER JOIN FABRIC AS FABRIC ON FABRIC.FabricID = ARTICLEFABRICASSIGN.FabricID INNER JOIN SUBDETAILS AS SUBDETAILS ON SUBDETAILS.SubDetailsID = FABRIC.ColorID WHERE (ARTICLE.BrandID = @artno)">
<SelectParameters>
<asp:ControlParameter ControlID="dgvIMF" Name="artno"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:aspnetdbConnectionString %>"
SelectCommand="SELECT DISTINCT ARTICLE.ArticleNo FROM PRICESIZESET INNER JOIN SIZESET ON PRICESIZESET.SizePriceID = SIZESET.SizeSetID INNER JOIN ARTICLE AS ARTICLE ON ARTICLE.ControlNo = PRICESIZESET.ControlNo INNER JOIN ARTICLEFABRICASSIGN AS ARTICLEFABRICASSIGN ON ARTICLEFABRICASSIGN.ControlNo = ARTICLE.ControlNo INNER JOIN FABRIC AS FABRIC ON FABRIC.FabricID = ARTICLEFABRICASSIGN.FabricID INNER JOIN SUBDETAILS AS SUBDETAILS ON SUBDETAILS.SubDetailsID = FABRIC.ColorID WHERE ARTICLE.ArticleNo = @brand">
<SelectParameters>
<asp:ControlParameter ControlID="ddlBrand" Name="brand"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>