0

I am new to MVC. Where to write C# code to common functionalists that is comming under master page(Eg: Login)?

Erik Funkenbusch
  • 91,709
  • 28
  • 188
  • 284
sugirthini
  • 47
  • 3

2 Answers2

0

Create partial *.ascx view for login in shared folder and add it to master page like this:

<% Html.RenderPartial("LoginUserControl"); %>
x2.
  • 9,396
  • 5
  • 37
  • 62
0

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

Community
  • 1
  • 1
Ofer Zelig
  • 16,560
  • 8
  • 54
  • 90