如何在单选框的文本字段中绑定文本值 [英] How to bind text value in textfield of radiolistbox
本文介绍了如何在单选框的文本字段中绑定文本值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:RadioButtonList runat="server" SelectedValue='<%#(Convert.ToString(Eval("Answerid")) != "0" ? Convert.ToString(Eval("Answerid")):"5") %>'
ID="Radiobtnanswer" RepeatColumns="1" RepeatDirection="Vertical">
<asp:ListItem Value="1"></asp:ListItem>
<asp:ListItem Value="2"></asp:ListItem>
<asp:ListItem Value="3"></asp:ListItem>
<asp:ListItem Value="4"></asp:ListItem>
<asp:ListItem Value="5" Text="" style="display: none" />
</asp:RadioButtonList>
我想要这样:
I want like this:
<asp:RadioButtonList runat="server" SelectedValue=''<%#(Convert.ToString(Eval("Answerid")) != "0" ? Convert.ToString(Eval("Answerid")):"5") %>''
ID="Radiobtnanswer" RepeatColumns="1" RepeatDirection="Vertical">
<asp:ListItem Value="1" Text=''<%Bind("abc")%>></asp:ListItem>
<asp:ListItem Value="2"></asp:ListItem>
<asp:ListItem Value="3"></asp:ListItem>
<asp:ListItem Value="4"></asp:ListItem>
<asp:ListItem Value="5" Text="" style="display: none" />
</asp:RadioButtonList>
推荐答案
让我们假设单选按钮列表为Radiobtnanswer,文本值列表为actionList.尝试以下代码:
Let us assume radiobuttonlist as Radiobtnanswer and list of text value as actionList. Try the below code:
radiobuttonlist.Items.AddRange(actionList.ToArray());
radiobuttonlist.DataBind();
这篇关于如何在单选框的文本字段中绑定文本值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文