?

Log in

No account? Create an account
 

ASP.NET Radio Button problem - Web Developer

About ASP.NET Radio Button problem

Previous Entry ASP.NET Radio Button problem Feb. 7th, 2005 @ 04:02 pm Next Entry
I am trying to read some radiobutton values into a a email function but
can't seem to get them to display if anyone has some ideas then let me
know, its doing my nut in.



Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)

' radio button list one
dim NoOfStaff=New SortedList
NoOfStaff.Add("1","1-9")
NoOfStaff.Add("2","10-49")
NoOfStaff.Add("3","50-99")
NoOfStaff.Add("4","100-149")
NoOfStaff.Add("5","150-199")
NoOfStaff.Add("6","200-249")
tb9.DataSource=NoOfStaff
tb9.DataValueField="Key"
tb9.DataTextField="Value"
tb9.DataBind()

' Radio Button List One
dim TypeOfCompany=New SortedList
TypeOfCompany.Add("1","Engineering")
TypeOfCompany.Add("2","Clothing/Textiles")
TypeOfCompany.Add("3","Food/Drink")
TypeOfCompany.Add("4","Healthcare")
TypeOfCompany.Add("5","Creative Industry")
TypeOfCompany.Add("6","Other (Please specify below) * ")
tb10.DataSource=TypeOfCompany
tb10.DataValueField="Key"
tb10.DataTextField="Value"
tb10.DataBind()

' list of variables
Dim name, company, position, address, phone, fax, email, web, staff, type, other, comments, newsletter As String

request variables
name=request.querystring("tb1")
company=request.form("tb2")
position=request.form("tb3")
address=request.form("tb4")
phone=request.form("tb5")
fax=request.form("tb6")
email=request.form("tb7")
web=request.form("tb8")
staff=request.form("tb9")
type=request.form("tb10")
other=request.form("tb11")
comments=request.form("tb12")
newsletter=request.form("tb13")

End Sub

' Send Email Function
Sub send_email(Sender as Object, E as EventArgs)

If Page.IsValid Then

Dim comptype as String

If request.form("tb10")= 1 Then
comptype = "Engineering"
Elseif request.form("tb10")= 2 Then
comptype = "Clothing/Textiles"
Elseif request.form("tb10")= 3 Then
comptype = "Food/Drink"
Elseif request.form("tb10")= 4 Then
comptype = "Healthcare"
Elseif request.form("tb10")= 5 Then
comptype = "Creative Industry"
Elseif request.form("tb10")= 6 Then
comptype = "Other (Please specify below) * "
End If

Display1.text = comptype


Dim MsgBody as String

MsgBody = "Name: "
MsgBody = MsgBody + tb1.text
MsgBody = MsgBody + "
Company:"
MsgBody = MsgBody + tb2.text
MsgBody = MsgBody + "
Position in company: "
MsgBody = MsgBody + tb3.text
MsgBody = MsgBody + "
Address: "
MsgBody = MsgBody + tb4.text
MsgBody = MsgBody + "
Phone: "
MsgBody = MsgBody + tb5.text
MsgBody = MsgBody + "
Fax: "
MsgBody = MsgBody + tb6.text
MsgBody = MsgBody + "
Email: "
MsgBody = MsgBody + tb7.text
MsgBody = MsgBody + "
Web Address: "
MsgBody = MsgBody + tb8.text
'MsgBody = MsgBody + "
No of Staff: "
'MsgBody = MsgBody + tb9.text
MsgBody = MsgBody + "
Type: "
MsgBody = MsgBody + comptype
MsgBody = MsgBody + "
Other: "
MsgBody = MsgBody + tb11.text
MsgBody = MsgBody + "
Comments: "
MsgBody = MsgBody + tb12.text
MsgBody = MsgBody + ""


' Create new email and send it
Dim newMail As New MailMessage
newMail.BodyFormat = MailFormat.html
newMail.From = "info@accordia.org.uk"
newMail.To = tb7.text
newMail.Subject = "Ready2Change Feedback Form"
newMail.Body = MsgBody

' Sending mail
SmtpMail.SmtpServer = "192.168.1.2"
Smtpmail.Send(newMail)

End If

End Sub
Current Mood: frustratedfrustrated
Leave a comment
From:xiota
Date:February 7th, 2005 04:09 pm (UTC)
(Link)
submit the form and then read the values with a server-side script? :)
[User Picture Icon]
From:fuzzygoth
Date:February 7th, 2005 04:13 pm (UTC)
(Link)
because i am developing in ibuyspy portal and all the forms
use postback, I can get all the text variable to postback
but not the radiobutton values and i don't know why
From:xiota
Date:February 7th, 2005 04:18 pm (UTC)
(Link)
< input type="radio" name="group1" value="Milk" > Milk < / input >

So the form field "group1" would equal "Milk" if this one was chosen. Make sure you don't have any errors in your form code.
From:xiota
Date:February 7th, 2005 04:28 pm (UTC)
(Link)
(^ that's my only suggestion - I loathe client-side scripting, sorry)
[User Picture Icon]
From:fuzzygoth
Date:February 7th, 2005 04:34 pm (UTC)
(Link)
no problem trying it now, i actually did all this asp.net checkbox
nonsense about a year ago and figured it out but not used it in so long
its all gone again :(
(Leave a comment)
Top of Page Powered by LiveJournal.com