Add property to an ASP.NET MVC 2 ViewUserControl

Posted by roosteronacid on Stack Overflow See other posts from Stack Overflow or by roosteronacid
Published on 2010-05-19T16:32:41Z Indexed on 2010/05/19 17:00 UTC
Read the original article Hit count: 390

Filed under:
|

I have created a ViewUserControl in my ASP.NET MVC 2 project. This ViewUserControl serves as the general page-header for all views in the project.

How can I add a custom property on ViewUserControls, accessible from views using that control?..:

<%@ Register
    Src="../Shared/Header.ascx"
    TagName="Header"
    TagPrefix="uc" %>

<uc:Header
    runat="server"
    ID="ucHeader"
    MenuItemHighlighted="Menuitem.FrontPage" /> <!-- custom property, here -->

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about usercontrols