Hi There,
I am new to ASP.Net with ContentPlaceholders.
My problemn is:
I have a masterpage on which are 3 ContentPlaceHolders.
ContentPlaceholderLeft, ContentplaceholderContent, ContentplaceholderRight.
In the Left I have a treeview in the Contentpart I have a Detailsview.
When I click at the left the content has to be changed with the ControlParameter, this lead to an Error can't find ControlParameter p1 from treeview.
When I do the same thing in the page without contentholders it works perfect.
Other problemn is, the treeview I am using has to start at different points.
In the topmenu it can select the Headcategory which changes the start values of the tree. Sometimes I use an other table for the tree to show it.
Under is my code. At the menu_ParentId that will be different for each Headcategory and must change everytime I click in the topmenu.
Hope there is someone who figered this out earlier.
Many thanks,
Johan Veldkamp
<asp:Content ID="Content1" ContentPlaceHolderID="LeftContentPlaceHolder" Runat="Server">
Voor Wie
<asp:TreeView ID="VoorWieTree" ExpandDepth="1" PopulateNodesFromClient="true" ShowLines="False" ShowExpandCollapse="True" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<asp: DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="Menu_Id" DataSourceID="menuitem_detail">
<Fields>
<asp:BoundField DataField="Menu_Id" HeaderText="Menu_Id" ReadOnly="True"
SortExpression="Menu_Id" Visible="false" />
<asp:BoundField DataField="Menu_Titel" HeaderText="Menu_Titel"
SortExpression="Menu_Titel" ShowHeader="false" />
<asp:BoundField DataField="Menu_Body" HeaderText="Menu_Body"
SortExpression="Menu_Body" ShowHeader="false" HtmlEncode="False" />
</Fields>
</asp: DetailsView>
<asp:SqlDataSource ID="menuitem_detail" runat="server"
ConnectionString="<%$ ConnectionStrings:BouwgegevensConnectionString %>"
SelectCommand="View_MenuItem" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="VoorWieTree" DefaultValue="1" Name="p1"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightContentPlaceHolder" Runat="Server">
</asp:Content>
Private Sub PopulateRootLevel()
Dim connectionString As String
connectionString = ConfigurationManager.ConnectionStrings("BouwgegevensConnectionString").ConnectionString
Dim objConn As New SqlConnection(connectionString)
Dim objCommand As New SqlCommand("select Menu_Id,Menu_Titel,(select count(*) FROM tbMenu " _
& "WHERE Menu_ParentID=sc.Menu_Id) childnodecount FROM tbMenu sc where Menu_ParentID = 1", objConn)
Dim da As New SqlDataAdapter(objCommand)
Dim dt As New DataTable()
da.Fill(dt)
PopulateNodes(dt, VoorWieTree.Nodes)
End Sub