Solved
Binding a web user control in another ContentPlaceHolder
Posted on 2006-07-18
I have a master page with multiple ContentPlaceHolders. The first one contains a web user control of class Controls_CategorySelector. The second one contains a data source, and one of its parameters is bound to the SelectedCategory property of the CategorySelector. How can this binding be done without compilation error?
<asp:Content ID="Content1" ContentPlaceHolderID="LeftMenuHolder" runat="Server">
<uc1:CategorySelector ID="catSelector" runat="server" OnLoad="CategorySelectorLoad"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentHolder" runat="Server">
<asp:SqlDataSource ID="ArticleDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:RTFMConnectionString %>"
SelectCommand="listRecentArticles" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="catSelector" DefaultValue="0" Name="categoryId"
PropertyName="SelectedCategory" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>
The ControlID "catSelector" is only found by the compiler if the data source and the CategorySelector are in the same ContentPlaceHolder.