了解 ASP.NET 上选择的输入无线电 (VB)
我正在使用 PlacHolders 在 ASP.NET 页面上动态创建输入无线电
。
While reader.Read
Dim ltr As New Literal()
Dim ltr1 As New Literal()
Dim ltr2 As New Literal()
Dim ltr3 As New Literal()
Dim ltr4 As New Literal()
ltr.Text = reader.GetString(2) & "<br />"
PlaceHolder2.Controls.Add(ltr)
ltr1.Text = "<form> <input type = radio name=groupe" & i & " value=1>" & reader.GetString(3) & "<br />"
PlaceHolder2.Controls.Add(ltr1)
ltr2.Text = "<input type = radio name=groupe" & i & " value=1>" & reader.GetString(4) & "<br />"
PlaceHolder2.Controls.Add(ltr2)
ltr3.Text = "<input type = radio name=groupe" & i & " value=1>" & reader.GetString(5) & "<br />"
PlaceHolder2.Controls.Add(ltr3)
ltr4.Text = "<input type = radio name=groupe" & i & " value=1>" & reader.GetString(6) & "</form><br /><br />"
PlaceHolder2.Controls.Add(ltr4)
i = i + 1
End While
我的问题是:如何获得在这些输入单选
上选择的所有项目。
I'm creating input radio
dynamicly on a ASP.NET page using PlacHolders.
While reader.Read
Dim ltr As New Literal()
Dim ltr1 As New Literal()
Dim ltr2 As New Literal()
Dim ltr3 As New Literal()
Dim ltr4 As New Literal()
ltr.Text = reader.GetString(2) & "<br />"
PlaceHolder2.Controls.Add(ltr)
ltr1.Text = "<form> <input type = radio name=groupe" & i & " value=1>" & reader.GetString(3) & "<br />"
PlaceHolder2.Controls.Add(ltr1)
ltr2.Text = "<input type = radio name=groupe" & i & " value=1>" & reader.GetString(4) & "<br />"
PlaceHolder2.Controls.Add(ltr2)
ltr3.Text = "<input type = radio name=groupe" & i & " value=1>" & reader.GetString(5) & "<br />"
PlaceHolder2.Controls.Add(ltr3)
ltr4.Text = "<input type = radio name=groupe" & i & " value=1>" & reader.GetString(6) & "</form><br /><br />"
PlaceHolder2.Controls.Add(ltr4)
i = i + 1
End While
My problem is : how can I get all the items selected on those input radio
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定你是如何使用 html 表单做到这一点的。
如果动态创建 RadioButton 控件而不是 Literals,则可以检查 RadioButton.Checked 属性以查看 ti 是否为 true。或者您可以使用 RadioButtonList 代替。
I am not sure how'd you do it with your html form.
If dynamically create a RadioButton control instead of Literals, then you could check the RadioButton.Checked property to see if ti's true. Or you could use a RadioButtonList instead.
如果您确实必须遵循上面的实现,则可以添加 ASP.NET HiddenField 控件并使用 javascript 将所选单选按钮的值转储到隐藏输入中。
If you REALLY had to follow the implementation you have above, you could add an ASP.NET HiddenField control and use javascript to dump the value of the selected radio button into the hidden input.