radio button event in web form

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?
 
T

Tom Spink

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
 
T

Tom Spink

???

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
 
J

John Davis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top