了解 ASP.NET 上选择的输入无线电 (VB)

发布于 2024-09-06 05:25:45 字数 1070 浏览 3 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绝不服输 2024-09-13 05:25:45

我不确定你是如何使用 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.

背叛残局 2024-09-13 05:25:45

如果您确实必须遵循上面的实现,则可以添加 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文