By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,306 Members | 1,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,306 IT Pros & Developers. It's quick & easy.

how to allow for null value with RadioButtonList

P: n/a
Jay
On my aspx page I have a FormView with a RadioButtonList bound to a column on
a DataSource table. The form starts up in Edit mode. I want the formView to
start up with nothing yet selected in the RadioButtonList. Is there a way to
do this? With null in the table/column, I get a startup error complaining
the SelectedValue is invalid because it does not exist in the list of items.
Thanks very much if someone has a way to solve this problem.
--
Jay
Feb 8 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
What you are can do is within your SELECT statement that you're using to
populate your FormView, test for the NULL value in your table and return an
empty string in place of it. The default SelectedValue for a
RadioButtonList is an empty string, meaning that no values have been
selected.

In SQL, replace your field in the SELECT with COALESCE(fieldname, '').
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Jay" <gu*****@ommunity.nospam> wrote in message
news:4B**********************************@microsof t.com...
On my aspx page I have a FormView with a RadioButtonList bound to a column
on
a DataSource table. The form starts up in Edit mode. I want the formView
to
start up with nothing yet selected in the RadioButtonList. Is there a way
to
do this? With null in the table/column, I get a startup error complaining
the SelectedValue is invalid because it does not exist in the list of
items.
Thanks very much if someone has a way to solve this problem.
--
Jay

Feb 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.