0

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

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
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,554
  • 6
  • 41
  • 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
  • 17,068
  • 9
  • 59
  • 93