来自数据库的 C# 动态单选按钮组

标签 c# radio-button

我有一个程序,当成员(member)资格即将到期时,该程序会从数据库中列出成员(member)。我想知道是否可以为每个成员生成并分组三个单选按钮,如下例所示:

成员(member) 1 o 续订 o 完成 o 结转

成员(member) 2 o 续订 o 完成 o 结转

成员(member) 3 o 续订 o 完成 o 结转

成员(member) 4 o 续订 o 完成 o 结转

然后,我将有一个提交按钮,该按钮将更新每个成员的数据,了解为他们选择的单选按钮。

谢谢

最佳答案

ASP.NET

如果您使用的是 ASP.NET 应用程序,则只需适当设置 GroupName 即可。请注意此声明from the MSDN documentation :

The buttons are grouped logically if they all share the same GroupName property.

Windows 窗体

如果您使用的是 Windows 窗体应用程序,则只需将每个 RadioButton 控件分组放入其自己的 GroupBoxPanel 中,它们就会被视为单独的分组。请注意此声明from the MSDN documentation :

All RadioButton controls in a given container, such as a Form, constitute a group. To create multiple groups on one form, place each group in its own container, such as a GroupBox or Panel control.

关于来自数据库的 C# 动态单选按钮组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15935075/

相关文章:

c# - 为什么在使用 Powershell 方法时 MSMQ 上的消息计数返回 0?

c# - OutOfMemoryException 错误

c# - Thread.Sleep(timeout) 和 ManualResetEvent.Wait(timeout) 有什么区别?

javascript - 选择选项之一(单选)时禁用某些输入元素

c# - 单选按钮组 XAML

c# - 如何使用 asp.net 将我的值从 c# 发送到 javascript

jquery - 动态禁用和启用单选按钮

javascript - 如何使用 jQuery 使一组单选按钮处于非事件状态?

android - fragment 中的单选按钮 findViewById

c# - 编程术语 - 字段、成员、属性 (C#)