2 Replies - 14313 Views - Last Post: 30 April 2009 - 03:46 AM

#1 Shaner312   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-March 09

How to display a textbox when checkbox is checked in Asp.net Visual St

Posted 29 April 2009 - 12:12 PM

I am working in Visual Studio 2008 C# Asp.net. The Webpage is populated from the fields in the database through a databind. I am getting my information from a table in my database off of SQL Server 2005. The purpose of this Webform is for users to input information to be stored on the database. I only want to display a Textbox if the user clicks on the Checkbox. I was planning on doing this in the .CS with an IF Statement but the problem I am running into is when I double click the Checkbox and am in the Checkbox_CheckChanged method the Textbox and the Checkbox are both out of Scope. Do you have any suggestions to get the checkbox and textbox to display so I can write code behind it? Thank you!!

Is This A Good Question/Topic? 0
  • +

Replies To: How to display a textbox when checkbox is checked in Asp.net Visual St

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6259
  • View blog
  • Posts: 24,028
  • Joined: 23-August 08

Re: How to display a textbox when checkbox is checked in Asp.net Visual St

Posted 29 April 2009 - 04:03 PM

Moving to ASP.NET.
Was This Post Helpful? 0
  • +
  • -

#3 b.ihde   User is offline

  • D.I.C for life
  • member icon

Reputation: 45
  • View blog
  • Posts: 1,070
  • Joined: 29-September 08

Re: How to display a textbox when checkbox is checked in Asp.net Visual St

Posted 30 April 2009 - 03:46 AM

Hi!

Well normally that IF Statement should work..

Did you try it like this? :

public void ....
{
if (checkbox1.checked == true)
 {
 textbox1.Visible == true;
 }
else if (checkbox.checked == false)
 {
 textbox1.Visible == false;
 }
}



regards

Ben
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1