RadioButtonList Selection Resets On Postback

  • Thread starter Thread starter David P. Donahue
  • Start date Start date
D

David P. Donahue

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
(e-mail address removed)
 
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.
 
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
(e-mail address removed)
 
Back
Top