Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET 2.0 - CheckBox.Checked not working

Status
Not open for further replies.

tahirk

Programmer
Oct 24, 2005
47
GB
Hi,

Probably something very simple that I have missed. I am in the process of converting an old ASP application to ASP.NET 2.0.

The code-behind is done in C# and so far I have had no problems however I have created a webform that contains several textboxes, drop down lists and checkboxes. I have a couple of classes that perform a lookup on the database and then populate the form fields with the data retrieved.

I can get all the data however I have noticed only he checkboxes do not seem to update i.e. they do not show the tick.

My code is being executed during the page load event and I have a simple line doing the following:
Code:
checkbox1.Checked = getcheckboxvalue();
The value is being returned correctly so I can't see why the checkbox is not displaying a tick once the page load is complete.

Any ideas?

Thanks in advance,

Fz
 
if getcheckboxvalue(); returns a bool value and the value returned is correct then the problem lies somewhere else.

postbacks usually trip developers up when they start using asp.net.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks jmeckley,

Textbook error on my part! I had some left over code from testing still sitting in my page_load event handler. I forgot to remove the code and do a type conversion on an ArrayList containing objects (the getcheckboxvalue() method wasn't handling the conversion a I had commented out some stuff lol).

All working and I have got some postback checks in place so the form is behaving properly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top