gpt4 book ai didi

c# - 如何将变量的值添加到 asp :ListItem in a asp:RadioButtonList

转载 作者:太空宇宙 更新时间:2023-11-03 19:27:57 25 4
gpt4 key购买 nike

我有这段代码:

<asp:RadioButtonList id="radInteresse" runat="server"> 
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:RadioButtonList>

我有这些字符串:

string var1="Only You";
string var2="Need Is";
string var3="Love";

现在,我想将 var1 的值设置为第一个 ListItem,将 var2 设置为第二个,将 var3 到第三个。

我该怎么做?

最佳答案

像这样:

radInteresse.Items[0].Value = var1;
radInteresse.Items[2].Value = var2;

关于c# - 如何将变量的值添加到 asp :ListItem in a asp:RadioButtonList,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7173083/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com