473,770 Members | 6,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to allow for null value with RadioButtonList

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
1 7298
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(fieldn ame, '').
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Jay" <gu*****@ommuni ty.nospam> wrote in message
news:4B******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4333
by: juststarter | last post by:
Hello, I have an aspx file where i've put a placeholder element. On load i create dynamically a table which contains a checkbox and a radiobuttonlist in each tablerow . The radiobuttonlist contains two items (yes,no). Both the checkboxes and the radiobuttonlist are NOT autopostbacked ( .autopostback = false). When i press the submit button a sub is run. My problem is that i can not get the selected items in the radiobuttonlists.This is...
4
9665
by: Emil | last post by:
Can somebody tell me what would be the syntax for having an if statement and setting the selected index of a radiobuttonlist? This is my first project using ASP.net and I use C#. I have a repeater with like a table layout and in the last column I want to have three radio buttons (for each row in repeater). The value of the radio button should be calculated from a value from the dataset. How can I do that? When I try to use a variable...
2
8970
by: Serg | last post by:
Hello, I need to set the selection in the RadioButtonList according to the value of SelectedValue in the underlying dataset - please suggest. The code is below. Thank you. <asp:TemplateColumn> <HeaderStyle Width="7px"></HeaderStyle> <ItemStyle HorizontalAlign="Center"></ItemStyle> <ItemTemplate> <asp:RadioButtonList DataTextField="SelectedValue" DataValueField="SelectedValue" RepeatDirection="Horizontal" ID="Selection"
2
7048
by: Alphonse Giambrone | last post by:
Hi all, I have two radiobuttonlist controls on a page. When a user checks 'No' for rblDeleted, I want to automatically set rblSendCard to 'No' and disable it. The javascript function I wrote to do this 'appears' to work on the screen, however, when the page is posted back and I check the value of rblSendCard, it is an empty string when I expect it to be 'N'. Of, course I can work around the problem by assuming 'N' when it is an empty...
5
2302
by: velu | last post by:
Problem in getting value from textbox & radiobuttonlist to a valuable inside a datagid. I want to insert a record into a table thru datagrid. Here is the code (see below) Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.ItemCommand
2
4739
by: Michael Bohman | last post by:
Hi, i have a small problem with assigning a database value to a RadioButtonList control. On my form i have 3 user admin=1, premium=2 and basic=3, theese values is stored in an access database in a text string. My problem is that when i'm loading my form, it uses a repeater control for each user by the way, I can't find a way to assign either of these values to the RadioButtonList Control. I can read them from the database but i wan't the...
0
1828
by: Scott_from_Carematic | last post by:
I'm trying to use a strongly typed dataset in my asp.net (2.0) project with visual studio 2005. I have generated the dataset and tableadapters in the designer. I'm using SQL server EE 2005 as the database. One of my tables has a guid field that has the "allow NULL" property in the database. If I create a <typed>datatable, then try to add a row to the new table, passing the value DBNULL.value as the field value in question, then I get...
2
2712
by: Vahagn | last post by:
Hi, how do I retrieve the chosen value from a RadioButtonList? I have a RadioButtonList that is populated dynamically with a "Next" button. Ie, I have a list of questions each with 2-3 answer options. When the "Next" button is pressed, it fetches the next question from the DB and the corresponding set of answers (only one of which is true). Then when the user chooses his answer / radio button from the list, he uses the same "Next" button to...
6
2643
by: SAL | last post by:
hello, I'm using a radiobuttonlist in an updatepanel in an item template in a Gridview control. I'm populating the radiobuttonlist in the RowDataBound event. I have the control toolkit registered in the page and I've got code to get the selected value from it in the Radiobuttonlist_SelectedIndexChanged event. The code in there is: Protected Sub rblFMSValue_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.