checkbox not working? ## RESOLVED MYSELF :) ##
hello
I am trying to change the value of a label using 2 checkboxes.
the label starts of with an emply string, if i click on the first checkbox, the label text should change to "hello" and if I click on the second check box the label should change to "bye"
I want this to happen without having to click on another button (after selecting a checkbox) to update the label.
I have the following code so far which does not work. please help:
VB Code:
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents RadioButton2 As System.Web.UI.WebControls.RadioButton
Protected WithEvents RadioButton1 As System.Web.UI.WebControls.RadioButton
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
Label1.Text = "hello"
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked = True Then
Label1.Text = "bye"
End If
End Sub
End Class