views:

80

answers:

1

Hello,

I have created a real simple templated UserControl using the following tutorial: http://msdn.microsoft.com/en-us/library/36574bf6(VS.80).aspx

I can now add this control to my mvc 2.0 application using:

<components:Box BoxType="Help" Title="Content Title" runat="server">
    <Content>
        <%: Html.TextBox("test") %>
        This is my awesome content!<br />
        <b>Test</b>
    </Content>
</components:Box>

However, when I go to the designer, I get an exception: Type 'System.Web.UI.UserControl' does not have a public property named 'Content'.

How can I fix this? I don't even need to use the drag-and-drop designer, just rendering the control will do fine.

Thanks!

A: 

The article you read is about ASP.NET WebForms and this won't work in ASP.NET MVC. It is safe to say you can ditch your work and start over.

Create a Partial View or Html Helper for reusable content in ASP.NET MVC.

mare
Thanks for the reply. Although I think you are wrong. I have tested it and it does work, except when adding code like the TextBox helper, because then it throws the exception.
SaphuA
ok then, continue on your path of WebForms style user controls with "runat=server" attribute in MVC world;)
mare