简体   繁体   English

表中的C#ASP.Net RadioButtonList: <td> 边界也创建边界清单项

[英]C# ASP.Net RadioButtonList within table: <td> border also creating border arount LIST ITEMS

I have created a table with borders collapsed around the table and a small gray border on each <td> . 我创建了一个桌子,桌子周围都有折叠的边框,每个<td>上都有一个小的灰色边框。 However the border is also surrounding each radio button items. 但是,边框也围绕每个单选按钮项。 The border attribute on the radio button appears to affect another border. 单选按钮上的border属性似乎会影响另一个边框。 How do I delete the border created on the <td> tag from the radio button list items? 如何从单选按钮列表项中删除在<td>标记上创建的边框?

    <tr>
        <td colspan="2">
                <asp:Label ID="lblJoint"  CssClass="boldIt" runat="server" Text="Is this for a joint account?" style="float: left; width: 200px;"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:RadioButtonList ID="rdlJoint" runat="server" RepeatDirection="Horizontal" Width="130px" style="float: left;" BorderStyle="None">
                    <asp:ListItem>Yes</asp:ListItem>
                    <asp:ListItem Selected="True">No</asp:ListItem>
                </asp:RadioButtonList>
        </td>
    </tr>

Use Flow RepeatLayout for RadioButtonList or create new css class for it : table.noBorder td { border: none; } 对RadioButtonList使用Flow RepeatLayout或为其创建新的CSS类: table.noBorder td { border: none; } table.noBorder td { border: none; } and use this class for your radiobuttonlist table.noBorder td { border: none; }和使用这个类为您的单选按钮列表

Susan, From what I can tell, when asp radiobuttonlist method is used, by default it creates a table with each radio button as a separate td. 苏珊,据我所知,当使用asp radiobuttonlist方法时,默认情况下它会创建一个表,其中每个单选按钮都作为单独的td。 The newly created table inherits the css class of the next table up the heirarchy. 新创建的表继承了继承关系中下一个表的css类。 If you use the 'RepeatLayout="Flow"' attribute, it will convert them to spans using the cssclass you define in the radiobuttonlist definition. 如果使用'RepeatLayout =“ Flow”'属性,它将使用您在单选按钮列表定义中定义的cssclass将它们转换为跨度。 Hope that helps. 希望能有所帮助。

Oops, just looked at the date. 糟糕,只是看着日期。 This is a little old, but maybe helpful. 这有点旧,但可能会有所帮助。

add style="border: none;" 添加style="border: none;" as attribute to the td-element 作为td元素的属性

When Asp.Net is interpreted as HTML, by default, tags are placed around each radio button item. 当Asp.Net解释为HTML时,默认情况下,标签会放置在每个单选按钮项周围。 If you have set a style on the element in your table, it will also be inherited by the radio button elements. 如果您在表中的元素上设置了样式,则单选按钮元素也会继承该样式。 To turn the border off on styling off, use the following property on the radio button control: RepeatLayout="Flow". 若要关闭样式设置的边框,请使用单选按钮控件上的以下属性:RepeatLayout =“ Flow”。

The border property on the radio button control is a separate border. 单选按钮控件上的border属性是一个单独的边框。

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

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