简体   繁体   English

如何在RadioButtonList ListItem文本中使用会话变量

[英]How to use a session variable in the RadioButtonList ListItem text

I am trying to create a Rediobuttonlist: 我正在尝试创建Rediobuttonlist:

In the options' text I want to insert a name of organisation which is logged in. I store the name in a Session variable. 我要在选项的文本中插入一个已登录组织的名称。我将该名称存储在Session变量中。

So if "A" is loggin in I want them to see: 因此,如果“ A”是登录名,我希望他们看到:

no longer a member of A but option1 不再是A的成员,而是option1

no longer a member of A but option2 不再是A的成员,而是option2

no longer a member of A but option3 不再是A的成员,而是option3

If "B" is logged in they should see: 如果“ B”已登录,他们应该看到:

no longer a member of B but option1 不再是B的成员,而是option1

no longer a member of B but option2 不再是B的成员,而是option2

no longer a member of B but option3 不再是B的成员,而是option3

and so on ... How can I do that? 等等...我该怎么做?

Normally I use a label and than in the code I write behind (c#): 通常,我使用标签,而不是在后面的代码中编写(c#):

label.text = "no longer a member of" + Session["name"]+"but option"; label.text =“不再是” + Session [“ name”] +“ but option”的成员;

but I can not isert a label to the Radiobutton list text. 但是我无法在“单选按钮”列表文本中添加标签。

Any ideas? 有任何想法吗?

Thanks. 谢谢。

maybe it helps you: 也许它可以帮助你:

    Dictionary<string,string> newlist = new Dictionary<string,string>();
    newlist.Add("opt1","no org" +Session["schubles"]+ "but opt bla");
    newlist.Add("opt2","no org" +Session["schubles"]+ "but opt blo");
    newlist.Add("opt3","no org" +Session["schubles"]+ "but opt blum");
    rlist.DataValueField = "key";
    rlist.DataTextField = "value";
    rlist.DataSource = newlist;
    rlist.DataBind();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM