locked
numbering using loops RRS feed

  • Question

  • User-2060576634 posted

    hi.. how can I add numbering (starting from number 1 until the foreach loop continues) to the following code structure instead of the word "numbering"?

           foreach(var row in questions)
           {
              <h6>numbering . @row.Text</h6>
              for(var i = 1; i < 5; i++)
              {
                     <p>@row["Choice" + i]<br></p> 
              }  
           }      
    Saturday, February 21, 2015 2:29 PM

Answers

  • User1853794821 posted
    var numbering=0;
    foreach(var row in questions)
           {
              
              <h6>@(numbering++) . @row.Text</h6>
              for(var i = 1; i < 5; i++)
              {
                     <p>@row["Choice" + i]<br></p> 
              }  
           }  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 21, 2015 3:00 PM