[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Group RADIO BUTTON and TEXT FIELD as one value for database

Posted on 2007-08-07
4
Medium Priority
?
610 Views
Last Modified: 2013-11-27
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
0
Comment
Question by:bcoussens
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 1500 total points
ID: 19650878
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
 

Author Comment

by:bcoussens
ID: 19651567
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
 
LVL 1

Expert Comment

by:glennonr
ID: 19654626
Try giving the radio buttons and the text field the same name
0
 
LVL 24

Expert Comment

by:mankowitz
ID: 19659252
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

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question