Ritendra Mall

Ritendra Mall

  • NA
  • 316
  • 33.3k

Pass one value at a time from the list

Oct 10 2019 2:47 PM
Hi,
 
I want to pass only one record at a time from the list & on the clicking of next button fetch the another record from the list .
 
Below is my Controller:-
  1. public ActionResult Questions()  
  2. {  
  3. List<QuestionsModel> quesLOV = new List<QuestionsModel>();  
  4. QuestionsModel quesModel = new QuestionsModel();  
  5. quesModel.Ques_ID = 1;  
  6. quesModel.Questns = "Qualities of Deliverable";  
  7. quesLOV.Add(quesModel);  
  8. quesModel = new QuestionsModel();  
  9. quesModel.Ques_ID = 2;  
  10. quesModel.Questns = "Adherence to timeliness/Schedule";  
  11. quesLOV.Add(quesModel);  
  12. quesModel = new QuestionsModel();  
  13. quesModel.Ques_ID = 3;  
  14. quesModel.Questns = "Estimation Accuracy?";  
  15. quesLOV.Add(quesModel);  
  16. return View(quesLOV.ToList());  
  17. }  
VIEW:-
  1. @model IList<QuizDemo.Models.QuestionsModel>  
  2. @{  
  3. ViewBag.Title = "Questions";  
  4. Layout = "~/Views/Shared/_Layout.cshtml";  
  5. }  
  6. <div class="container-fluid">  
  7. <hr />  
  8. <form style="padding-top:50px">  
  9. <div class="alert alert-dismissible alert-primary">  
  10. @foreach (var Obj in Model)  
  11. {  
  12. <label style="font-size:25px;padding-bottom:50px">Questions:@Obj.Questns</label>  
  13. <input id="input-1" name="input-1" class="rating rating-loading" data-min="0" data-max="5" data-step="0.1" value="2" data-size="sm">  
  14. }  
  15. </div>  
  16. <button type="button" class="btn btn-outline-primary btn-lg" style="float:right">Next</button>  
  17. </form>  
  18. </div>  
Please suggest .
Thank you

Answers (1)