@Html.HiddenFor(x =>x.StreamId, Model.StreamId)
@Html.LabelFor(m => m.StreamId)
<select id="streamlist" name="list" onchange="DDLStream();">
@for (int i = 0; i < @Model.dtforStream.Rows.Count; i++)
{
<option value="@Model.dtforStream.Rows[i][0]">@Model.dtforStream.Rows[i][1].ToString()</option>
}
</select>
<p><input type="submit" value="Create" /></p>
function DDLStream() {
var k = $("#streamlist").val();
$("#sid").val(k);
alert(k);
}
答案 0 :(得分:0)
$("#StreamId").val(int.parse($("#streamlist option:selected").val()));