471,350 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

RadioButtonList Selection Resets On Postback

I'm having a strange problem with a RadioButtonList (manually populated
in the HTML, not data-bound) on one of my ASP .NET pages. I have the
user select a value and click a button, then the code-behind's function
for that button re-sorts a list based on the selected value. However,
every postback results in the same sorting, and the RadioButtonList on
the page always returns to the default value. Is there something else I
need to be doing here?
Regards,
David P. Donahue
dd******@ccs.neu.edu
Jan 17 '06 #1
2 3664
David,

Are you checking the IsPostBack property on your page to determine
whether or not to sort, or to initialize the page? The same instance of
your class is not always going to be used in the processing of your page, so
you can't assume the state will be saved between post backs (nor can you
assume that your page will remember the state, hence the need for the check
on whether or not it is a post back).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"David P. Donahue" <dd******@ccs.neu.edu> wrote in message
news:OI**************@TK2MSFTNGP11.phx.gbl...
I'm having a strange problem with a RadioButtonList (manually populated in
the HTML, not data-bound) on one of my ASP .NET pages. I have the user
select a value and click a button, then the code-behind's function for
that button re-sorts a list based on the selected value. However, every
postback results in the same sorting, and the RadioButtonList on the page
always returns to the default value. Is there something else I need to be
doing here?
Regards,
David P. Donahue
dd******@ccs.neu.edu

Jan 17 '06 #2
> Are you checking the IsPostBack property on your page to determine
whether or not to sort, or to initialize the page?


Everything in Page_Load is wrapped in an "if (!IsPostBack){ ... }"
condition, so I should think that the function associated with clicking
the button would be the only code being executed.

I've also tried having no default selection on the RadioButtonList, but
it just returns to no selection after the postback (leaving the sorting
clause in the SQL which binds the control being sorted empty).
Regards,
David P. Donahue
dd******@ccs.neu.edu
Jan 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.