1

My app has the following structure for views...

form related views

  • views/form/datecontrol.cshtml
  • views/form/textcontrol.cshtml
  • views/form/checkboxcontrol.cshtml

...etc and

search related views

  • views/search/searchgrid.cshtml

now,in searchgrid.cshtml, I want to make a partial call to the controls under form. I tried all of the following but it still throws up an error.

@Html.Partial("~/form/textcontrol",
@Html.Partial("/form/textcontrol",
@Html.Partial("views/form/textcontrol",

How do i go about with this ?

tereško
  • 58,060
  • 25
  • 98
  • 150
user748526
  • 33
  • 4

1 Answers1

3

Put the shared views in the "Shared" folder, and then reference them as you would any other partial:

@Html.Partial("textcontrol")

If they must be in some other folder, try (be sure to include the ~/):

@Html.Partial("~/Views/form/textcontrol.cshtml")

how i can render Partial views in asp.net mvc 3

Community
  • 1
  • 1
Fourth
  • 9,163
  • 1
  • 23
  • 28