<form action="" method="post" style="text-align:center">
<table>
<tr>
<th style="height:50px;font-size:26px;">
关于本项目的培训课程是否满意?</th>
</tr>
<tr style="height:50px">
<td>
<input type="radio" name="satis" value="1" />满意
<input type="radio" name="satis" value="2" />较满意
<input type="radio" name="satis" value="3" />欠满意
</td>
</tr>
<tr style="height:50px">
<td>
<input type="button" value="提交" onclick="" />
</td>
</tr>
</table>
</form>
我想点击提交按钮后能把单选按钮里的Value值赋到数据库中表里面的一个字段,应该怎么实现呢?比如表是Student,里面有个字段是Value。
请帮一下我,万分感谢。
ASP.NET MVC3中单选按钮的值如何赋值到数据库表
答案:2 悬赏:0
解决时间 2021-03-14 11:47
- 提问者网友:独菊痴梦
- 2021-03-13 16:23
最佳答案
- 二级知识专家网友:一起来看看吧
- 2021-03-13 17:24
<html>
<head>
<title>Index</title>
<script src="../../Scripts/jquery-1.5.1.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$(".radio").click(function () {
if ($(this).attr("checked") == true) {
$("#statis").val($(this).val());
}
});
});
</script>
</head>
<body>
<div>
<form action="" method="post" style="text-align: center">
<table>
<tr>
<th style="height: 50px; font-size: 26px;">
关于本项目的培训课程是否满意?
</th>
</tr>
<tr style="height: 50px">
<td>
<input type="radio" class="radio" name="satis1" value="1" />满意
<input type="radio" class="radio" name="satis1" value="2" />较满意
<input type="radio" class="radio" name="satis1" value="3" />欠满意
<input id="statis" name="statis" type="hidden" />
</td>
</tr>
<tr style="height: 50px">
<td>
<input type="button" value="提交" onclick="" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<head>
<title>Index</title>
<script src="../../Scripts/jquery-1.5.1.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$(".radio").click(function () {
if ($(this).attr("checked") == true) {
$("#statis").val($(this).val());
}
});
});
</script>
</head>
<body>
<div>
<form action="" method="post" style="text-align: center">
<table>
<tr>
<th style="height: 50px; font-size: 26px;">
关于本项目的培训课程是否满意?
</th>
</tr>
<tr style="height: 50px">
<td>
<input type="radio" class="radio" name="satis1" value="1" />满意
<input type="radio" class="radio" name="satis1" value="2" />较满意
<input type="radio" class="radio" name="satis1" value="3" />欠满意
<input id="statis" name="statis" type="hidden" />
</td>
</tr>
<tr style="height: 50px">
<td>
<input type="button" value="提交" onclick="" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
全部回答
- 1楼网友:晨与橙与城
- 2021-03-13 18:24
和普通的asp.net项目一样的...ado.net或者linq不会因为开发模式的不同就变了
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯