简体   繁体   English

从以编程方式创建的RadioButtonList中获取选定的值

[英]Get the selected value from a programatically created RadioButtonList

In my ASP.NET project I need to create a RadioButtonList for each column of a dynamically sized table. 在我的ASP.NET项目中,我需要为动态大小表的每一列创建一个RadioButtonList。 The table's dimensions are set via Web Service. 该表格的尺寸是通过Web服务设置的。 For this scenario I create a RadioButtonList in a loop 对于这种情况,我在循环中创建了一个RadioButtonList

for (int j = 0; j < columns; j++)
{
    //Create a RadioButtonList for each column/////////
      RadioButtonList rbl = new RadioButtonList();
      rbl.ID = "rbl" + j.ToString();
      rbl.RepeatDirection = RepeatDirection.Vertical;

The code works as intended, but for further processing I need to get the selected RadioButton's ID inside the RadioButtonList from outside the loop. 代码按预期工作,但是为了进行进一步处理,我需要从循环外部获取RadioButtonList内的选定RadioButton的ID。 How do I have to do this? 我该怎么做?

Kind regards 亲切的问候

简单的方法是通过Global创建一个RadioButtonList并在循环内添加Radiobutton,然后可以在循环外获取选定的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM