|
-
Apr 10th, 2007, 09:45 AM
#1
Thread Starter
Lively Member
Checkbox
Hello all,
Why this never occurs?
Code:
Protected Sub chkName_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkName.CheckedChanged
If chkName.Checked = True Then
txtName.Visible = True
Else
txtName.Visible = False
End If
End Sub
The point is to click in the check box and depending on chkName 's value turn txtName's visibility on or off.
But when I run my app, this never occurs. It was supose to run this code when I click in chkName
Thanks, :P
-
Apr 10th, 2007, 10:16 AM
#2
Re: Checkbox
Set the checkbox's autopostback property to true.
-
Apr 10th, 2007, 10:16 AM
#3
Re: Checkbox
the code never runs because when the user clicks the checkbox, the page doesn't post back to the webserver to process that code.
In the designer, select the checkbox, and from the properties window, set the AutoPostBack property to true. This will cause the page to submit to itself when you click the checkbox, and fire the page_load event, and then fire the code from your post above.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|