如何设置中继器内 asp 选中的第一个单选按钮

how to set first radio button checked in asp inside repeater

Check first radio button with JQuery

嗨, 我已经完成了上面的 link 它工作正常但是我在中继器控件中也有 asp:RadioButton 所以想检查第一个单选按钮。上面 link 中的答案适用于正常 html 但不适用于 asp:radiobutton 类型,请帮助, 提前致谢!!

由于您还没有发布您的代码,所以我只能猜测一下,但我将如何做到这一点:

RadioButton 可以这样编码:

<asp:RadioButton ID="rb" Checked='<%# Container.ItemIndex == 0 ? true : false %>' runat="server"/>

这将检查 Repeater 发出的第一个 RadioButton。

希望对您有所帮助。