473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reading Radio Button Values into the database

I have used 4 radiobuttons nd not radiobutton list.what ia m atrying to do is i want to store the text value of the buttong in DB. But in the insert query i am not gettin the method to select its value..........i.e if i take ' " + radiobutton1.text + " ' then how would i select the other button value......................
I have written a code that is working for itbut i am not satisfied with it if there could be any other method for it............i would really appreciate.....
UI am writing down my code:

CODE----
Dim cls As New dbconnection
Dim s As String = "Upgrade"

Dim q As String = "Software"
--------------------------------------------------------------------------------------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Dim Textarea As String
'Textarea = Textarea1.Value
cls.dbconnection(True)
cls.ExecuteQuery("INSERT INTO Troubleshooting(StartDate,Type,InTermsof,Priority, Description,ProposedUsage,ApproximateCost,Status,T ypeOfRequest)
Values ('" + CDate(TextBox1.Text.ToString) + "','" & s & " ','" & q & " ', '" + DropDownList1.SelectedValue.ToString + "','" + TextBox4.Text + "','" + TextBox5.Text + " ',' " & TextBox3.Text.Trim & " ','Not Started','Configuration')")

cls.dbconnection(False)
Response.Redirect("Successmsg.aspx", True)
End Sub
--------------------------------------------------------------------------------------------------------------------
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged


If RadioButton1.Checked = True Then
RadioButton1.Text = "New"
s = RadioButton1.Text.ToString
Else
s = ""
End If
End Sub
--------------------------------------------------------------------------------------------------------------------
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked = True Then
RadioButton3.Text = "Hardware"
q = RadioButton3.Text.ToString
Else
q = ""

End If
End Sub

what to do plz guide me down.....................urgent
Thanks in advance
Apr 12 '07 #1
1 1361
gomzi
304 100+
I have used 4 radiobuttons nd not radiobutton list.what ia m atrying to do is i want to store the text value of the buttong in DB. But in the insert query i am not gettin the method to select its value..........i.e if i take ' " + radiobutton1.text + " ' then how would i select the other button value......................
I have written a code that is working for itbut i am not satisfied with it if there could be any other method for it............i would really appreciate.....
UI am writing down my code:

CODE----
Dim cls As New dbconnection
Dim s As String = "Upgrade"

Dim q As String = "Software"
--------------------------------------------------------------------------------------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Dim Textarea As String
'Textarea = Textarea1.Value
cls.dbconnection(True)
cls.ExecuteQuery("INSERT INTO Troubleshooting(StartDate,Type,InTermsof,Priority, Description,ProposedUsage,ApproximateCost,Status,T ypeOfRequest)
Values ('" + CDate(TextBox1.Text.ToString) + "','" & s & " ','" & q & " ', '" + DropDownList1.SelectedValue.ToString + "','" + TextBox4.Text + "','" + TextBox5.Text + " ',' " & TextBox3.Text.Trim & " ','Not Started','Configuration')")

cls.dbconnection(False)
Response.Redirect("Successmsg.aspx", True)
End Sub
--------------------------------------------------------------------------------------------------------------------
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged


If RadioButton1.Checked = True Then
RadioButton1.Text = "New"
s = RadioButton1.Text.ToString
Else
s = ""
End If
End Sub
--------------------------------------------------------------------------------------------------------------------
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked = True Then
RadioButton3.Text = "Hardware"
q = RadioButton3.Text.ToString
Else
q = ""

End If
End Sub

what to do plz guide me down.....................urgent
Thanks in advance
my hunch is that you will be better off with a radiobuttonlist.

Its great that you have posted the code, but it will be easier to understand your problem if you try and explain a bit more.
Apr 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: entoone | last post by:
I am able to make a selection of information when entering a record, with radio buttons giving the option of yes, or no. Which stores their answer as yes, or no in the database. I then have an...
1
by: David | last post by:
Hi, I have an ASP page with a form and the following code: ..... type=Radio Checked name=selectserial value=" & RS("PSL_F_Serial")..... Tis will carry over the value of RS("PSL_F_Serial"),...
4
by: Jay | last post by:
I have a form used to submit data (no surprises there!). I'd like to be able to populate the same form with previously submitted data. The data lives in a database once submitted and using ASP I...
4
by: Hazzard | last post by:
What is the best way to do this? Binary with 0 representing off and 1 on? Int16 with 1 representing first button, 2 the second, 3 ... varchar with a character values at certain positions in the...
2
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.