radio button event in web form

  • Thread starter Thread starter John Davis
  • Start date Start date
J

John Davis

I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons.
When the user click the first radio button, the text will change to
uppercase. If the user clicks the other radio button, the text will change
to lowercase.

I added the following event, but still won't able to change the text to
uppercase.
Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RadioButton1.CheckedChanged
TextBox1.Text = UCase(TextBox1.Text)
End Sub


any ideas?
 
You may want to check out the ASP.NET newsgroups, they could probably help
you, but FYI, the RadioButton needs to be set to AutoPostback.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit
 
???

He said ASP.NET in his original post... And he also X-Posted to the ASP.NET
newsgroup

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit
 
Yes, once I set the property of radio button to AutoPostBack=True, the text
in the text box will change automatically when i click the radio button.

However, since I have 2 radio buttons, when I click one of the radio button,
the text will change. When I click the other radio button, the check mark
still there in the previous radio button. OK, then I do the following to
clean up the old choice. But it is tedious if there are 10 radio buttons,
since radio button only allows users to choose ONE CHOICE at a time. I just
think to clear the old check mark should be done automatically as ASP.NET
feature, not programmatically. Maybe I just don't know. Please
advice.Thanks.

Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RadioButton1.CheckedChanged
RadioButton2.Checked = False
TextBox1.Text = UCase(TextBox1.Text)
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles RadioButton2.CheckedChanged
RadioButton1.Checked = False
TextBox1.Text = LCase(TextBox1.Text)
End Sub


John
 
John,
Please don't cross post
I now have to watch not to send this answer to the asp.net group

You use a radiobutton as a checkbox.

In mine idea the purpose from the radio button is to set it in a group.
radiobutton1.groupname = "John"
radiobutton2.groupname = "John"

when you push on button 1 button 2 is cleared and visa versa
Cor
 
Back
Top