N
Nobody
Is it possible to have nested datasources?
I have a page that I want laid out like this:
rptCategories ==> Category 1
rptItems ==> Item 1
rptCategories ==> Category 2
rptItems ==> Item 1
rptCategories ==> Category 3
rptItems ==> Item 1
so basically rptCategories is bound to a datasource that calls a stored proc
in the database which returns the categories for the current brand
inside of that, I have rptItems which I want to display the items for the
category of the current brand... the brand id is passed in as a query
string, but the category id is passed in from the rptCategories, but I can't
figure out how to specify that... here is my source:
<asp:SqlDataSource ID="dsCategories" runat="server"
ConnectionString="<%$ ConnectionStrings:cstrDataSource %>"
SelectCommand="sp_GetCategoriesByBrandID"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Name="BrandID"
QueryStringField="BrandID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:Repeater ID="rptCategories" runat="server"
DataSourceID="dsCategories">
<ItemTemplate>
<hr />
<a style="font: Verdana; font-size:14pt; color:#555555;
font-weight:normal">
<%# DataBinder.Eval(Container.DataItem, "Name") %>
</a>
<br />
<br />
<asp:SqlDataSource ID="dsItems" runat="server"
ConnectionString="<%$ ConnectionStrings:cstrDataSource %>"
SelectCommand="sp_GetItemsByBrandIDAndCategoryID"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Name="BrandID"
QueryStringField="BrandID" Type="Int32" />
THIS LINE ERRORS===><asp
arameter Name="CategoryID" Type="Int32"
DefaultValue=<%# DataBinder.Eval(Container.DataItem, "CategoryID") %> />
</SelectParameters>
</asp:SqlDataSource>
<asp:Repeater ID="rptItems" runat="server"
DataSourceID="dsItems">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name") %>
</ItemTemplate>
</asp:Repeater>
<br />
</ItemTemplate>
</asp:Repeater>
</asp:Content>
How do I specify that?
Thanks!
I have a page that I want laid out like this:
rptCategories ==> Category 1
rptItems ==> Item 1
rptCategories ==> Category 2
rptItems ==> Item 1
rptCategories ==> Category 3
rptItems ==> Item 1
so basically rptCategories is bound to a datasource that calls a stored proc
in the database which returns the categories for the current brand
inside of that, I have rptItems which I want to display the items for the
category of the current brand... the brand id is passed in as a query
string, but the category id is passed in from the rptCategories, but I can't
figure out how to specify that... here is my source:
<asp:SqlDataSource ID="dsCategories" runat="server"
ConnectionString="<%$ ConnectionStrings:cstrDataSource %>"
SelectCommand="sp_GetCategoriesByBrandID"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Name="BrandID"
QueryStringField="BrandID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:Repeater ID="rptCategories" runat="server"
DataSourceID="dsCategories">
<ItemTemplate>
<hr />
<a style="font: Verdana; font-size:14pt; color:#555555;
font-weight:normal">
<%# DataBinder.Eval(Container.DataItem, "Name") %>
</a>
<br />
<br />
<asp:SqlDataSource ID="dsItems" runat="server"
ConnectionString="<%$ ConnectionStrings:cstrDataSource %>"
SelectCommand="sp_GetItemsByBrandIDAndCategoryID"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Name="BrandID"
QueryStringField="BrandID" Type="Int32" />
THIS LINE ERRORS===><asp
DefaultValue=<%# DataBinder.Eval(Container.DataItem, "CategoryID") %> />
</SelectParameters>
</asp:SqlDataSource>
<asp:Repeater ID="rptItems" runat="server"
DataSourceID="dsItems">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name") %>
</ItemTemplate>
</asp:Repeater>
<br />
</ItemTemplate>
</asp:Repeater>
</asp:Content>
How do I specify that?
Thanks!