日期:2014-05-17  浏览次数:20380 次

关于MVC获取界面数据的问题。
我设计的一个实体类,分两级。主表关联多张明细表。
我希望用界面的控件数据构建一个这样的结构。问题是:分数要通过选择来确认的。这个该怎么实现?

C# code


class head
{
string master;
List<Details> lst;
}

class Details
{
int score;
}




HTML code

<table border="1">
<tr>
<th>主表</th>
<th>明细</th>
<th>明细</th>
<th>明细</th>
</tr>
    <tr>
        <td rowspan="2">
        大项内容
        </td>
        <td>
            小项内容1
        </td>
        <td>
            <input id="Radio2" type="radio" name="Radio2" value="1" />1
            <input id="Radio2" type="radio" name="Radio2" value="2" />2
        </td>
        <td>
            所得分数<input id="Text1" type="text" />
        </td>
    </tr>
    <tr>
        <td>
            小项内容2
        </td>
        <td>
            <input id="Radio1" type="radio" name="Radio1" value="1" />1
            <input id="Radio1" type="radio" name="Radio1" value="2" />2
        </td>
        <td>
            所得分数<input id="Text1" type="text" />
        </td>
    </tr>
</table>



------解决方案--------------------
如果你是要再Action中获取Radio中得值 
public ActionResult Select(FormCollection collection)
{
int score2=int.Parse(f["Radio2"]);
int score1=int.Parse(f["Radio1"]);

}