简体   繁体   中英

How to use a session variable in the RadioButtonList ListItem text

I am trying to create a 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.

So if "A" is loggin in I want them to see:

no longer a member of A but option1

no longer a member of A but option2

no longer a member of A but option3

If "B" is logged in they should see:

no longer a member of B but option1

no longer a member of B but option2

no longer a member of B but option3

and so on ... How can I do that?

Normally I use a label and than in the code I write behind (c#):

label.text = "no longer a member of" + 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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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