Deal with asp:placeholder control from code behind (C#) : Placeholder « Asp Control « ASP.Net






Deal with asp:placeholder control from code behind (C#)

<%@ Page Language="c#" src="ProgControl_cb.cs" Inherits="MyNamespace.ProgControl" %>
<html>
<head>
   <title>Programmatic Control Example using Code-behind</title>
</head>
<body>
   <form runat="server">
      <asp:placeholder id="PH" runat="server"/>
   </form>
</body>
</html>


<%--

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MyNamespace
{
   public class ProgControl:Page
   {
      protected PlaceHolder PH = new PlaceHolder();

      void Page_Load()
      {
         // The placement of the Placeholder control 
         //   determines where output appears
         Literal Message = new Literal();
         Message.Text = "This text set from Page_Load!";
         PH.Controls.Add(Message);
      }
   }
}
--%>
           
       








Related examples in the same category

1.asp:placeholder control