c# - Controller to render all Partial Views -
i'm new asp.net mvc4. have application uses numerous partial views, have controller using return partialview each of them, makeing long file.
public partialviewresult somepartial() { return partialview("someparital"); } public partialviewresult someotherpartial() { return partialview("someotherparital"); } is there way create controller return partialview entire folder/directory?
thanks,
you can render partial views directly markup using html helper. easiest way store every partial view name list somewhere, , use render every partial view name.
@{ var mypartialviews = new string[] { "someparital", "someotherparital" }; } @foreach(string partialview in mypartialviews) { html.partial(partialview) //or html.renderpartial(partialview); }
Comments
Post a Comment