G
Guest
Hi there,
I have a curious problem I can't seem to solve. I have a list box that gets
filled with data, the user selects an item in this list, then a form view
displays the full details from that list. The problem I have is that the
list box and the form are in different content placeholders, and I can't get
them to work together. I have this code:
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="SideContent">
<p>
<asp:SqlDataSource ID="SelectSupportingDocs" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [Title] FROM
[tblSupportingDocs]"></asp:SqlDataSource>
<asp:ListBox ID="lbSelectDocument" runat="server"
AutoPostBack="True" CssClass="ListBox" DataSourceID="SelectSupportingDocs"
DataTextField="Title" DataValueField="ID"></asp:ListBox>
</p>
</asp:Content>
<asp:Content ID="Content3" runat="server"
ContentPlaceHolderID="SupportingDoc">
<asp:FormView ID="FormView2" runat="server"
DataSourceID="SelectedSupportingDoc"
<EditItemTemplate></EditItemTemplate>
<InsertItemTemplate></InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="PageTextLabel" runat="server" Text='<%#
Bind("PageText") %>'></asp:Label>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SelectedSupportingDoc" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [PageText] FROM [tblSupportingDocs] WHERE
([ID] = @ID)">
<SelectParameters>
<asp:ControlParameter ControlID="lbSelectDocument" Name="ID"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>
From what I can see, the ControlParameter, controlID is set to the correct
control. However, when the page is run, I get an error " could not find
control lbSelectDocument in controlParameter ID".
I assume this is becuase they are in different containers. Can I reference
the control from it current location? (at the moment content2 is a side bar,
and content 3 is the main form).
Thanks for any help.
I have a curious problem I can't seem to solve. I have a list box that gets
filled with data, the user selects an item in this list, then a form view
displays the full details from that list. The problem I have is that the
list box and the form are in different content placeholders, and I can't get
them to work together. I have this code:
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="SideContent">
<p>
<asp:SqlDataSource ID="SelectSupportingDocs" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [Title] FROM
[tblSupportingDocs]"></asp:SqlDataSource>
<asp:ListBox ID="lbSelectDocument" runat="server"
AutoPostBack="True" CssClass="ListBox" DataSourceID="SelectSupportingDocs"
DataTextField="Title" DataValueField="ID"></asp:ListBox>
</p>
</asp:Content>
<asp:Content ID="Content3" runat="server"
ContentPlaceHolderID="SupportingDoc">
<asp:FormView ID="FormView2" runat="server"
DataSourceID="SelectedSupportingDoc"
<EditItemTemplate></EditItemTemplate>
<InsertItemTemplate></InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="PageTextLabel" runat="server" Text='<%#
Bind("PageText") %>'></asp:Label>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SelectedSupportingDoc" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [PageText] FROM [tblSupportingDocs] WHERE
([ID] = @ID)">
<SelectParameters>
<asp:ControlParameter ControlID="lbSelectDocument" Name="ID"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>
From what I can see, the ControlParameter, controlID is set to the correct
control. However, when the page is run, I get an error " could not find
control lbSelectDocument in controlParameter ID".
I assume this is becuase they are in different containers. Can I reference
the control from it current location? (at the moment content2 is a side bar,
and content 3 is the main form).
Thanks for any help.