我该如何纠正这个问题 [英] How do I rectify this problem

查看:93
本文介绍了我该如何纠正这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#开发使用RAZOR引擎的mvc应用程序,我在使用两个模型时面临问题。我的代码如下:

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

@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想要一个模型使用列表<>

和另一个正常



请给我一个解决方案或建议



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

please give me a solution or suggestion

推荐答案

你必须创建一个新的类,它包含你想要的对象的属性,然后使用这个新类作为你的模型。
You have to create a new class that contains as properties your wanted objects, then to use this new class as your model.


这篇关于我该如何纠正这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆