Group RADIO BUTTON and TEXT FIELD as one value for database

Hello,  I am building a web form within Visual Web Developer 2005 express and SQL express.
I have a section that collects data from radio buttions (ID: "business_type" with 10 options 1 called "other" when "other" is selected i want to capture data from the text field below these radio buttions.  
how do i group these? is that possible or do i need to link the button value "other" with the TEXT field value?  how do i do this?
Thanks in advance
bcoussensAsked:
Who is Participating?
 
mankowitzConnect With a Mentor Commented:
If you are using databinding, you will have to make a custom binding function for the database. You can then define the .format and .parse handlers to deal with it. This is some pseudocode. First you create a new databinding between the dataset and the DB. Next you add a handler for the parse method of the binding. This method is called when the data is to be saved into the db. Finally, you define the parse method. In this case, suppose that the radiobuttons are named radiobutton_optionX and the radiobox beside the other textbox is radiobutton_other

b = New Binding("...", dataset, "fieldname")
AddHandler b.Parse, AddressOf CkToDB

    Public Sub CkToDB(ByVal sender As Object, ByVal e As ConvertEventArgs)
        if radiobutton_other.checked then
                e.Value = othertextbox.value
        else if radiobutton_option1.checked then
                e.Value = radiobutton_option1.value
        else if radiobutton_option2.checked then
                e.Value = radiobutton_option2.value
       'etcetc
       endif
       
    End Sub
0
 
bcoussensAuthor Commented:
thanks Mankowits,
Unfortunatly I am not advanced as i suggested on the posting (i thought that was a discription of the question)
I'm not really familiar with DATABINDING I am new to .NET 2.0  
Also this list of radio buttons is dynamicaly built and i will not know how many will be there as the user can add items to this list.  will this affect the working of the code (if i have to list the valie for each radio button)
0
 
glennonrCommented:
Try giving the radio buttons and the text field the same name
0
 
mankowitzCommented:
OK, what is the business logic you currently use to check the values of the radiobuttons? Can you show us the cod?

Do something like this:
[Set the database value to the name of the selected radiobutton]
IF [the textbox contains some string] THEN [set the database value to the text in the box]
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.