asp.net - Create three columns layout, all dynamic -
i want create dynamic website in asp.net using mvc model visual studio 2013.
all columns have dynamic content, each 1 changing it's content on different selections based on user actions or controllers.
how can create 3 dynamic columns?
i have layout in html , css need separate 3 columns , have possibility change content controllers.
later edit: in case have 2 menus in website, 1 left , other 1 right. 3 other 1 top. when select top, menu left must showed depending on top selection.
you can populate each column using viewbag
or viewdata
. in layout, use data pupulate columns, example:
1) calling action change content specify:
public actionresult myview() { // can put in viewbag, // string, list of , use in view // dinamyc viewbag.column1 = "my content column 1"; viewbag.column2 = "my content column 2"; viewbag.column3 = new string[] {"product1", "product1", "product1"}; }
2) consume data in layout generate dynamic content:
<div id='column1'> @viewbag.column1 </div> <div id='column2'> @viewbag.column2 </div> <div id='column3'> <ul> @foreach(var s in viewbag.column3) { <li> @s </li> } <ul>
you should take here more information:
you should use sections well, take here:
Comments
Post a Comment