Saving selectedIndex state for subclass of RadioButtonList

J

Jay

I am new to building custom controls. I have subclassed RadioButtonList to provide a rollover effect where I can provide details on each option. I am having trouble saving the state of the selectedIndex. When I post back the currently selected option is lost. I am digging into various references on building custom controls, but if someone can provide information on what I need to do so that on post backs the selected option still shows I would greatly appreciate it.

Jay
 
D

Dale

Have you tried:

ViewState["SelectedValue"] = myRbl.SelectedIndex;

and

myRbl.SelectedIndex = (int)ViewState["SelctedValue"];

Save it any time you have it locked down in code after OnInit, and retrieve
it anytime after OnInit on postback.

Dale Preston
MCAD, MCSE, MCDBA

I am new to building custom controls. I have subclassed RadioButtonList to
provide a rollover effect where I can provide details on each option. I am
having trouble saving the state of the selectedIndex. When I post back the
currently selected option is lost. I am digging into various references on
building custom controls, but if someone can provide information on what I
need to do so that on post backs the selected option still shows I would
greatly appreciate it.

Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top