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

大兔子大兔子 提交于 2019-12-12 03:23:40

问题


I have created a table with borders collapsed around the table and a small gray border on each <td>. However the border is also surrounding each radio button items. The border attribute on the radio button appears to affect another border. How do I delete the border created on the <td> tag from the radio button list items?

    <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>

回答1:


Use Flow RepeatLayout for RadioButtonList or create new css class for it : table.noBorder td { border: none; } and use this class for your radiobuttonlist




回答2:


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. The newly created table inherits the css class of the next table up the heirarchy. If you use the 'RepeatLayout="Flow"' attribute, it will convert them to spans using the cssclass you define in the radiobuttonlist definition. Hope that helps.

Oops, just looked at the date. This is a little old, but maybe helpful.




回答3:


add style="border: none;" as attribute to the td-element




回答4:


When Asp.Net is interpreted as HTML, by default, tags are placed around each radio button item. 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".

The border property on the radio button control is a separate border.



来源:https://stackoverflow.com/questions/9384220/c-sharp-asp-net-radiobuttonlist-within-table-td-border-also-creating-border-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!