jeudi 24 décembre 2015

Create col1, col2, col3 using MVC where (1,2,3 are dynamically generated)

  • 1> .cs page
public partial class TBL_FG_MENUS
{
     public string ColName1{ get; set; }
     public string ColName2{ get; set; }....ntimes

     public string ColValue1{ get; set; }
     public string ColValue2{ get; set; }....ntimes
}

Question:

  1. I need to loop inside view using this model

    2> .cshtml page (view)

 @{
     int i=1;
     foreach(var item in Model)
     {
         <p>@item.ColName+i<p><br/>
         i++;
     }

     i=1;
     foreach(var item in Model)
     {
         <p>@item.ColValue+i<p><br/>
         i++;
     }

 }

Here I want ColName1, ColValue1 n times inside the loop

Aucun commentaire:

Enregistrer un commentaire