views:

41

answers:

1

I'm trying to run the templated user control example provided by MSDN. Code is as follows:

So according to MSDN this should implement as follows:

<%@ Register Assembly="MyAssembly" Namespace="MyAssembly.Controls" TagPrefix="abs" %>
<abs:TemplatedFirstControl id = "First"  runat=server
                           Text= "The time on the server is "  >
      <FirstTemplate>
          <h3><font face="Verdana" color = "red">
                 <%# Container.Text %> <%# Container.DateTime %>
              </font>
          </h3>
      </FirstTemplate>      
    </abs:TemplatedFirstControl>

Designer complains that content is not allowed between the opening and closing tags of TemplatedFirstControl and that FirstTemplate is not supported. So what's missing? I duplicated MSDN's code verbatim

MSDN Article: http://msdn.microsoft.com/en-us/library/aa720695%28v=VS.71%29.aspx

A: 

It sounds like the compiler is not recognizing that FirstTemplate is a valid child element of TemplatedFirstControl. Check the following:

  • Is FirstTemplate a public property of the codebehind class of TemplatedFirstControl?
  • Is there a public child template control class defined, that derives from Control and implements INamedContainer?
  • Is the FirstTemplate property decorated with a TemplateContainer attribute?
  • Does that attribute correctly specify the type of the child template control?
KeithS
Well as stated I used the exact code in the MSDN article. Which I had recreated here but someone edited my post and commented it all out. TemplatedFirstControl is not usercontrol. It's a server control class. But it looks to me like all those bases are covered.
D.Forrest