Preserving state of radio controls

A

Antonio Maciel

Hi.

One custom control I am creating generates a series of radio buttons. These
are html radio buttons, not the server version. When I run the control the
radio buttons are created ok, so I click one of them and refresh the page.
The selected option disappears. How can I preserve the selection when the
user refreshes the page, or when he switches to another page and back? Do I
need to use session variables?

Thanks,

Antonio Maciel
 
V

Victor Garcia Aprea [MVP]

Hi Antonio,

If you want your radiobutton's to preserve state you will need to examine
the posted form data and update them accordingly so when they render they do
so in the same state they were when they posted. This is what the
RadioButton type already does, so you may want to consider writing a
composite custom control and having some RadioButton childs.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top