【发布时间】:2017-04-22 00:10:10
【问题描述】:
我在 asp:table 中动态创建单选按钮。我想获取所选单选按钮的 id。
- 如何检查控件类型
-
如何获取其 ID。
RadioButton radioButton = new RadioButton(); radioButton.ID = id + "RadioButton"; radioButton.ToolTip = text; radioButton.Attributes.Add("id", id); radioButton.GroupName = categoryID + "Questions"; radioButton.EnableViewState = true; radioButton.AutoPostBack = true; radioButton.Checked = isSelected; radioButton.CssClass = style; TableCell cell = new TableCell(); cell.HorizontalAlign = HorizontalAlign.Left; cell.Controls.Add(radioButton); TableRow row = new TableRow(); row.Cells.Add(cell); table.Rows.Add(row);
【问题讨论】:
-
您想在服务器端回发时获取 id?
标签: c# asp.net radio-button findcontrol