如何向RadioButtonList添加超链接
我尝试了以下操作,但它仍然呈现为纯文本。
<asp:RadioButtonList runat="server" id="rdlTest">
<asp:ListItem Value="1" Text="<a href='Page2.aspx?1'>A</a>"></asp:ListItem>
<asp:ListItem Value="2" Text="<a href='Page2.aspx?2'>B</a>"></asp:ListItem>
</asp:RadioButtonList>我知道下面的工作,但我想使用RadioButtonList而不是RadioButton。
<asp:RadioButton runat="server" ID="rdoTest" Text="<a href='Page2.aspx?1'>A</a>" />更新
其他代码搞砸了这件事。所以我的原始代码没有问题。我有一个用rdlTest清除和重新加载Page_Load上的rdl.Items.Add(new ListItem("1","A")的函数,这就是重写工作标记。
发布于 2012-09-19 20:11:21
你就不能做点像..。
<asp:CheckBoxList ID="chk" runat="server">
<asp:ListItem Value="0"><a href="http://www.asp.net">asp.net</a></asp:ListItem>
<asp:ListItem Value="1"><a href="http://forums.asp.net">forums.asp.net</a></asp:ListItem>
</asp:CheckBoxList>RadioButtonList和CheckBoxList的工作方式应该类似。
发布于 2012-09-19 20:12:42
您可以始终为他们分配一个id,然后连接Javascript (或jQuery)中的onclick事件。
<asp:ListItem Value="1" Text="A" ID = "A"></asp:ListItem>
$('#A').click(function(){
window.location='Page2.aspx?1'
}https://stackoverflow.com/questions/12502098
复制相似问题