ASP .net MVC - Master page
I am new to MVC. Where to write C# code to common functionalis开发者_运维问答ts that is comming under master page(Eg: Login)?
Create partial *.ascx view for login in shared folder and add it to master page like this:
<% Html.RenderPartial("LoginUserControl"); %>
Html.RenderAction()
/ Html.Action()
, which do not require a Model to be passed.
That is, what @x2 suggested is OK if the control is not dependent on any model, but if it is, use one of the above methods.
See: The difference between Html.Action and Html.RenderAction
And: http://haacked.com/archive/2009/11/18/aspnetmvc2-render-action.aspx
精彩评论