Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing mvc application using RAZOR engine using C# and i am facing problem when using two model my. my code is given below
XML
@model List<AnswerSheetValuation.Models.ExamPattern>
@model AnswerSheetValuation.Models.ExamPattern 
@{
    Layout = null;    
}
<table>
<tr>
<td>
@Html.TextBoxFor(model => model.Description)
</td>
</tr>
</table>


for (int i = 0; i < Model.Count; i++)
                 {

                     if (i == 0)
                     {
tr class="highlight" id="@("Exid" + @Model[i].id)" >
                             <td style="text-align:left;width:50%;">
                             <a  href="javascript:void(0);" onclick='GetExamSubject("@Model[i].id")'> @Model[i].ExamName </a>
                             </td>
                             <td style="text-align:center;width:25%;"> @Model[i].GroupName</td>
                             <td style="text-align:center;width:25%;"> @Model[i].TotalSubject</td>
                         </tr>
                     }
}


i want one model using list<>
and another one normal

please give me a solution or suggestion
Posted
Comments
Viswanath Manikandan 9-Jan-14 23:36pm    
is it possible to access the model in that same view

1 solution

You have to create a new class that contains as properties your wanted objects, then to use this new class as your model.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900