radio button list doesn't hold value?

  • Thread starter Thread starter KathyB
  • Start date Start date
K

KathyB

Hi. I have a radio button list with list items assigned via a
datareader from a database. Everything looks fine, the items are there
on page load, I can click one, etc. There is also a required validator
on the list.

However, when I hit SUBMIT, the selection disappears so the first line
of my submit click code (If Page.IsValid = True Then)...is always
"false" and nothing happens of course.

I'm probably just tired of staring at it, but how does this happen?

Thanks again. Kathy
 
KathyB said:
Hi. I have a radio button list with list items assigned via a
datareader from a database. Everything looks fine, the items are there
on page load, I can click one, etc. There is also a required validator
on the list.

However, when I hit SUBMIT, the selection disappears so the first line
of my submit click code (If Page.IsValid = True Then)...is always
"false" and nothing happens of course.

I'm probably just tired of staring at it, but how does this happen?

Kathy,

As an experiment, try removing the RequiredFieldValidator, then, on
PostBack, check to see if you can change RadioButtonList.SelectedItem. I'd
also suggest turning on page tracing and look to see what gets posted back
for the RadioButtonList.
 
Make sure you're using the check for IsPostBack in your Page_Load as
appropriate. You don't want to rebind your button list datasource
everytime, it should be in a check:

If Not IsPostBack Then
'create datasource/bind to list
End If

in Page_Load. As well as any other setup that is only to be run once....
 
Back
Top