vendredi 28 septembre 2018

OnCheckedChanged event returns Check Box always as unchecked

I am trying to work in a VB project, but since is my first experience in VB i am having some kind of difficulties. I a have a check Box and a text box. I want that if the user checks the check box the text box to enable.

 <tr>
 <td></td>
 <td style="width:100px; ">Staff:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp                                                                          

  <asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True" 
      OnCheckedChanged="CheckBox3_CheckedChanged" />
 </td>
 <td style="width:200px; ">

 <edititemtemplate>

 <telerik:RadTextBox ID="RadTextBox2" width="100%" Runat="server" 
     Enabled="false">

 </telerik:RadTextBox>

</edititemtemplate>
</td>  
   <td class="Validator_Cls"></td>                                                                  
   </tr>

and this is the code behind

Dim RadTextBox2 As New TextBox
Dim WithEvents CheckBox3 As New CheckBox

    Public Sub CheckBox3_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox3.CheckedChanged
    If CheckBox3.Checked = True Then
        RadTextBox2.Enabled = True
    End If

End Sub

the thing is that even when i check the check box the if clause says that check box is not checked and does not enter in the if statement.

Any idea where i am doing wrong? Please help because this is taking longer than it should.

Aucun commentaire:

Enregistrer un commentaire