【问题标题】:Radio button text on the right side右侧的单选按钮文本
【发布时间】:2011-12-07 17:50:49
【问题描述】:

我在我的应用程序中使用单选按钮,有什么方法可以将文本从左侧移动到右侧

【问题讨论】:

  • 您是否尝试过像我发布答案的方式?
  • 是的,问题是当我点击内容时,按钮不会被选中
  • 您使用的是纯 HTML 吗?确保标签引用单选按钮的 id。然后单击标签将选择单选按钮。
  • @Mathew Paul 如果你想实现喜欢点击内容,写一些代码在标签的点击事件中选择单选按钮。
  • @kalyan 是的,谢谢 Kalyan,我会做类似的事情

标签: asp.net c#-4.0


【解决方案1】:

在它所属的列表中将TextAlign 属性设置为“Right”。

请看这里:http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobuttonlist.textalign.aspx

示例(在 VS 中使用标准 WebApplication 并在 default.aspx 中包含以下内容):

<asp:RadioButtonList id="RadioButtonList1"
     RepeatDirection="Vertical" 
     RepeatLayout="Table"  
     TextAlign="Right"  
     runat="server">

    <asp:ListItem>Item 1</asp:ListItem>
    <asp:ListItem>Item 2</asp:ListItem>
    <asp:ListItem>Item 3</asp:ListItem>
    <asp:ListItem>Item 4</asp:ListItem>
    <asp:ListItem>Item 5</asp:ListItem>
    <asp:ListItem>Item 6</asp:ListItem>

</asp:RadioButtonList>

将TextAlign设置为Left的结果是:

【讨论】:

  • @AlexDuggleby,但它不会将单选按钮文本从控件的左侧更改为右侧
  • 必须不同意,请参阅扩展答案。还是我误会了什么?
  • @AlexDuggleby,他需要像“Text(righttothat)Radiocontrol”而不是“Radiocontrol(lefttocontrol)Text”这样的功能
  • 我再次尝试使用上面的代码在单选按钮的左侧显示文本
  • 好的,所以将TextAlign设置为Left,查看答案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-10-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-02
相关资源
最近更新 更多