Resets to default value when clicking a button

S

staeri

I have two client-side input radio buttons with javascript attached.
Clicking one hides one of two div's and vice versa.

The problem is that when I click an <asp: Button> which fills a grid
the "checked" attribute on my input radio buttons gets reset to the
default value.

If I for example select radio button 2 I want it to be selected after
I've clicked the <asp: Button>.

How can I solve this problem?

Regards,

S
 
M

Mischa Kroon

If I for example select radio button 2 I want it to be selected after
I've clicked the <asp: Button>.

How can I solve this problem?

Make the radio buttons serverside controls.
Then set the values progammaticly on postback and do the logic serverside.
If you want to avoid a complete retransfer of the page you can use Ajax.
 
S

staeri

But I want to have the radio buttons client-side because it looks much
nicer when I can hide the div instantly without a server trip.


Mischa Kroon skrev:
 
S

staeri

Unfortunately none of this work. The default value is still reset.

Actually all I need to do is to run the javascript attached to radio
button 2 after the code attached to <asp:Button> has been executed. Is
that possible?


Mischa Kroon skrev:
 
E

Eliyahu Goldin

You can have both. Just add "runat=server" to the radio buttons html. It
will enable ViewState and the value will be preserved on round trips. And
keep your logic client-side.
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top