Attaching elements

Step 13 – Examples of MyUrlAction.aspx and MyUrlAction.aspx.cs

The following are simple examples of the MyUrlAction.aspx and MyUrlAction.aspx.cs.

One thing to note here is that some extra controls are used to get the C1 CMS looks on the page.

<%@ Page Language="C#" AutoEventWireup="true" Inherits="MyUrlAction" CodeFile="MyUrlAction.aspx.cs" %>
<%@ Register TagPrefix="control" TagName="httpheaders" Src="~/Composite/controls/HttpHeadersControl.ascx" %>
<%@ Register TagPrefix="control" TagName="scriptloader" Src="~/Composite/controls/ScriptLoaderControl.ascx" %>
<%@ Register TagPrefix="control" TagName="styleloader" Src="~/Composite/controls/StyleLoaderControl.ascx" %>
<html xmlns="" xmlns:ui="" xmlns:control="">
  <control:httpheaders ID="Httpheaders1" runat="server" />
    <title>My URL Action</title>
    <control:styleloader ID="Styleloader1" runat="server" />
    <control:scriptloader ID="Scriptloader1" type="sub" runat="server" />
    <ui:dialogpage label="My URL Action" image="${skin}/dialogpages/message16.png">
        <asp:PlaceHolder ID="MyPlaceHolder" runat="server" />

And now the MyUrlAction.aspx.cs file:

using System;
using System.Linq;
using System.Web.UI;
using Composite.Data;
using Composite.Data.Types;
public partial class MyUrlAction : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
      string pageIdString = this.Request.QueryString["pageId"];
      if (pageIdString == null) throw new InvalidOperationException();
      Guid pageId = new Guid(pageIdString);
      using (new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo))
        IPage page = PageManager.GetPageById(pageId);
        this.MyPlaceHolder.Controls.Add(new LiteralControl("Title: " + page.Title + "<br />"));

You can do all sorts of things here. This is only a very simple and naïve example.