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

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -