Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
How can I reference ContentPlaceHolder Control inside the WebSplitter template?
posted
I have a Master Page and a content page named "Default.aspx".
-In the Master Page, It contains a WebSplitter. The left SlitterPane contains links and the right SplitterPane contains a ContentPlaceHolder.
-In the Default.aspx, it's a content page and referencing Master Page, so this content page is actually the child of ContentPlaceHolder of the Master Page.
-When ran the Default.aspx, I tried to reference the ContentPlaceHolder in the Page Load method of Default.aspx.vb , but it couldn't find the ContentPlaceHolder control. Here's my referencing code in  the Default.aspx.vb: 
          
                    Dim content As ContentPlaceHolder
                   
content = Page.Master.FindControl("ContentPlaceHolder1")

-The code work if I put the ContentPlaceHolder outside the WebSplitter in the Master Page.

-----------Here's my Master Page Design Code------------:

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
<%
@ Register Assembly="Infragistics2.Web.v8.2, Version=8.2.20082.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.LayoutControls" TagPrefix="ig" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" style="overflow:hidden; height:100%; width:100%;">

<head runat="server">
    
<title>Web Splitter Master Page</title>
</
head>

<
body style=" margin:0px; padding:0px; height:100%; width:100%; margin-bottom: 1px; margin-right:1px;">
    
<form id="form1" runat="server" style="height:100%;width:100%" >

          <
asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

          <ig:WebSplitter ID="WebSplitter1" style="height:100%; width:100%; " runat="server">
              
<panes>
                   
<ig:SplitterPane runat="server" Size="15%" CollapsedDirection="PreviousPane">
                        
<Template>Left Navigation</Template>
                   
</ig:SplitterPane>
                   
<ig:SplitterPane runat="server">
                          
<Template>
                               
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
                                    
Content Page Inside the ContentPlaceHolder1
                               
</asp:contentplaceholder>
                          
</Template>
                   
</ig:SplitterPane>
           
</panes>
        
</ig:WebSplitter>
     
</form>
</
body>
</html>

--------Here's my Default.aspx design code---------:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    
Welcome To My Page!
</asp:Content>

----------Here's my Page Load method in the Default.aspx.vb-------:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
Dim content As ContentPlaceHolder
     content = Page.Master.FindControl(
"ContentPlaceHolder1")
End Sub

 

Parents
No Data
Reply
  • 95
    posted

    I found a solution:

    In Page Load method in the Default.aspx.vb, I have the following code, and I can find the ContentPlaceHolder control.

    Here's the code:

    Dim WebSplitter As Infragistics.Web.UI.LayoutControls.WebSplitter
    Dim SplitterPane As Infragistics.Web.UI.LayoutControls.SplitterPane
    Dim TemplateContainer As Infragistics.Web.UI.TemplateContainer
    Dim contentPlaceHolder As ContentPlaceHolder

    WebSplitter = Page.Master.FindControl("WebSplitter1")
    SplitterPane = WebSplitter.Panes(1)
    TemplateContainer = SplitterPane.Controls(0)
    contentPlaceHolder = TemplateContainer.FindControl(
    "ContentPlaceHolder1")

     

Children