c# - 我怎样才能防止asp :RadioButtonList from rendering a HTML-Table?

标签 c# asp.net radiobuttonlist

<分区>

我想呈现一个简单的列表 - 控件。 我的 ASP.NET 代码隐藏看起来像:

RadioButtonList list = new RadioButtonList();
                    list.ID = rbl.name;
                    list.CssClass = rbl.cssClass;

                    foreach (radio radio in rbl.radio)
                    {
                        ListItem li = new ListItem();
                        li.Text = radio.label;
                        li.Value = radio.value;
                        li.Selected = radio.@checked;
                        list.Items.Add(li);

                    }

但是 RadioButtonList 会自动呈现一个 HTML 表格。如果我使用 HtmlInputRadioButton 一切正常,但它在 RenderControl() 上崩溃

最佳答案

你应该看看RadioButtonList.RepeatLayout Property

Use this property to specify whether the items in the RadioButtonList control are displayed in a table. If this property is set to RepeatLayout.Table, the items in the list are displayed in a table. If this property is set to RepeatLayout.Flow, the items in the list are displayed without a table structure.

关于c# - 我怎样才能防止asp :RadioButtonList from rendering a HTML-Table?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2183827/

相关文章:

c# - Xml - '=' 是意外 token ,预期 token 是 ';'

c# - 如何将数据从 LINQ to Entities 查询流式传输?

c# - 是否可以以编程方式隐藏单选按钮列表的特定列表项?

javascript - 在单选按钮列表中设置警报时出错?

javascript - ASP.NET RadioButtonList 和渐进式增强

C# XML 序列化向后兼容性

c# - 如果程序意外关闭,IDisposable 对象是否会被处理掉?

c# - map 服务器: anyplatfom (opensource or not) to embed into website to query with SQL for further breakdown

asp.net - 表单例份验证 Cookie 过期

c# - 在独立的 C# 类中存储 Javascript/JQuery