dimanche 10 mai 2015

MVC 4 Rating System

sorry that I'm quite new to MVC4. Im building an mvc4 rating system.

First, i was created a view to input the rating question field and store the info into rating db as below:

Rating Question Input
==============================
Question : [ What Fruit You Like? ] 
Sub Question : Apple ; Orange ; Grapes
Number of Radio Button : [3]
Rating Header : Hate ; Like ; Very Like

My Ratingdb field:

public class RatingInput
    {
        public int Id { get; set; }
        public int QuestionId { get; set; }
        public string Question { get; set; }
        public string Subquestion { get; set; }
        public int NumberRadioButton { get; set; }
        public string ratingheader { get; set; }
    }

How was the data look like in db :

Question             | Subquestion         | NumberRadioButton | ratingheader
What Fruit you Like? | Apple;Orange;Grapes |         3         | Hate;Like;Very Like

How do i generate the seperate line in table for the question and radio button? The illustrate output as below:

1. What Fruit You Like ?

                  Hate     Like      Very Like
Apple             []        []          []
Orange            []        []          []
Grapes            []        []          []

My Rating Output page code sample :

 @foreach (var item in Model)
    {
        <tr>

            <td>
                @Html.DisplayFor(modelItem => item.Question)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SubQuestion) *Need Help
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.NumberRadioButton) *Need Help
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ratingheader) *Need Help
            </td>

        </tr>
    }

Aucun commentaire:

Enregistrer un commentaire