Jun 7, 2011 at 8:13 PM
Edited Jun 8, 2011 at 8:00 PM
There are some rather large inaccuracies the claims above - we got a lot more asp.net webforms conformance than that.
> It's not simple to reference a textbox in one usercontrol from the button submit handler in another
False - your controls end up en the same control tree, below the same Page and you can define server side ID's all you wish - if you need to dig out a control from somewhere on the page, you can do this pretty easily. Code sample below.
> You can't ... reference Page.Header since its not defined as a server control
False - do this in a control, and you change the pages title: this.Page.Header.Title = "Hello World";
We create a Header element based on the <head /> that html, xslt'etc. generate - this Header can then be changed/used by asp.net.
> You can't ... do (Page as myBaseType).SomeBaseProperty since you don't have access to setting the type you want a template to inherit from
True - if ASP.NET Page sub classing is a requirement, Composite C1 wont help.
> You cant't ... use Ajax Page Methods since they need to be defined on the page which you don't have access to
False - if you need the <asp:ScriptManager /> on a page, include it. You can do so via a Control just fine.
> You cant't ... do template inheritance like with masterpages
False - you can do all kinds of crazy layout inheritance with the C1 Function system, and for instance XSLT. The XSLT starter site do this a lot.
True - if you specifically mean asp.net master page inheritance.
> You cant't ... use any of the Webform Menu Controls since they rely on asp.net Sitemap
False - you can add any control you want to. You would need to register a sitemap provider, but saying you can not have webforms menus is not true.
Here is a video showing the bits below running:
A few of the above points is shown in this code sample. It is to user controls you can place where you want, and they will do AJAX, talk to (find) each other and update the page Header. To install it:
- Create a new Composite C1 site, use the XSLT templates if you please
- Copy the two controls below to your ~/Frontend folder
- Embed them on some page / template / a mix - just have the two controls active on the same page. Use the embed sample markup below, and use aither A.ascx or B.ascx.
- Save, publish, browse to the page and click/debug away.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="A.ascx.cs" Inherits="ControlA" %>
<asp:TextBox ID="AText" runat="server" />
<asp:Button runat="Server" onclick="AButton_Click" Text="Click me" />
<asp:ScriptManager ID="ScriptManager1" runat="server" AjaxFrameworkMode="Enabled" />
<asp:UpdatePanel runat="server" ChildrenAsTriggers="true" UpdateMode="Always">
<%= DateTime.Now %>.<%= DateTime.Now.Millisecond %>
<asp:Button Text="AJAX" runat="server" />
public partial class ControlA : System.Web.UI.UserControl
protected void AButton_Click(object sender, EventArgs e)
// Accessing the page head
this.Page.Header.Title = AText.Text;
// Grabbing a label from another control - we expect to find it or explode
Label bLabel = (Label)FindControlRecursive(this.Page,"BLabel");
bLabel.Text = "A's text box says " + AText.Text;
private Control FindControlRecursive(Control root, string id)
if (root.ID == id)
foreach (Control c in root.Controls)
Control t = FindControlRecursive(c, id);
if (t != null)
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="B.ascx.cs" Inherits="ControlB" %>
<asp:Label ID="BLabel" runat="server" />
public partial class ControlB : System.Web.UI.UserControl
Embedding a user control on a page, template or xslt output:
<f:function name="Composite.AspNet.LoadUserControl" xmlns:f="http://www.composite.net/ns/function/1.0">
<f:param name="Path" value="~/Frontend/A.ascx" />