Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


PlaceHolder inside ContentPlaceholder

Posted on 2008-11-04
Medium Priority
Last Modified: 2013-12-17
Why is it not possible to access PlaceHolder control from cs file, which is placed in ContentPlaceHolder aspx page in the Content section?
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentCategories" runat="Server">
<ASP:DataList id="CatDataList" RepeatColumns="1" runat="server">
        <table cellpadding="10" style="font: 10pt verdana">
            <td valign="top">
              <b>Category: </b><%# DataBinder.Eval(Container.DataItem, "CategoryName") %> <br /> <br />
              <asp:PlaceHolder ID="phGridProject" runat="server"> </asp:PlaceHolder>                       

Open in new window

Question by:VonGunten
  • 3

Expert Comment

ID: 22875910
It's because you have it nested in a DataList ItemTemplate.

Author Comment

ID: 22876005
Ok, but how to reach it?

I tried with:
PlaceHolder ph1 = ((PlaceHolder)CatDataList.FindControl("phGridProjects"));

but when I try to add a control to ph1 there is an exception thrown that the reference is not set to an instance of an object.

How to reach this PlaceHolder.

Author Comment

ID: 22876029
One more thing. I try to reach it in inside of OnItemDataBound method.

Accepted Solution

VonGunten earned 0 total points
ID: 22876175
Ok. I got it. It has to be:

 PlaceHolder ph1 = ((PlaceHolder)e.Item.FindControl("abc"));

Thanks anyway

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question