TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
gerald vince
NA
15
7.2k
Enable or disable textboxes based on a check
Feb 25 2015 7:03 PM
I have been trying to get this to work for days, and everything i have read through google shows it should be right, so I have no idea what I am doing wrong, I have a simple checkbox. and once that is checked, i need two other textboxes to become visible or enabled, I dont care which. I am also not stuck on a checkbox, if something is easier I am all for it.
HTML
<tr>
<td>
</td>
<td style="height: 51px; width: 377px; font-weight: bold;">
Project Completed?</td>
<td>
<asp:CheckBox ID="CheckBox_ProjectResults" OnCheckedChanged="CheckBox_ProjectResults_CheckedChanged" runat="server" Width="200px"></asp:CheckBox>
</td>
</tr>
<tr>
<td>
</td>
<td style="height: 51px; width: 377px; font-weight: bold;">
End Date</td>
<td>
<asp:TextBox ID="TxtActualEnd" runat="server" Width="200px" autocomplete="off"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td style="height: 51px; width: 377px; font-weight: bold;">
Results Folder</td>
<td>
<asp:FileUpload ID="attachmentFileUpload" runat="server" Width="320px"/>
</td>
</tr>
and here is the C# behind it
protected void CheckBox_ProjectResults_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox_ProjectResults.Checked == true)
{
TxtActualEnd.Enabled = false;
attachmentFileUpload.Enabled = false;
}
else
{
TxtActualEnd.Enabled = true;
attachmentFileUpload.Enabled = true;
}
}
Reply
Answers (
2
)
returning datetime to textbox
Referenced Zip files and why VS2005 in 2015?