How can you determine the height of a checkboxlist at runtime?

S

szako

I have a scenario where I need to position a submit button below a
dynamically filled checkboxlist with an unknown number of records
(check boxes). In order to pull this off (using absolute positioning),
I need to be able to determine the height of the checkboxlist at
runtime after I bind it to a dataset.

When I check the Height.Value property of the checkboxlist web control
at runtime it returns 0.0. I saw a post that says you have to set the
initial height property first before you can retrieve a value, but
doing that did not allow me to get the new height property after I
loaded the checkboxlist with the dataset.

Once I can determine the height of this control, I can add that value
as part of an algorithm to determine where to place the submit button
(below the checkboxlist).

If anyone has any ideas or solutions, please post them as this has
wasted WAY TOO MUCH of my time. :)

Thanks,
szako
 
K

Ken Cox [Microsoft MVP]

I don't have an answer for you, but I'm curious why you must use absolute
positioning.

It seems like if you added all the controls to a placeholder and let it
flow, you'd have it done by now?
 
S

Shane Zako

I agree that if I had chosen a different pattern I would probably be
done by now too. Unfortunately, this is the last piece that I haven't
figured out yet and I'm already way down the road on this one. I don't
know much about the placeholder control. I'll look into that for next
time. The next page I develop like this I will use Flow layout and see
which way is easier.


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
S

szako

I was never able to get the Height property of the Checkboxlist
webcontrol to work properly. I had to finally just write an algorithm
to determine the height of each row in the checkboxlist and then add
up each row for the total height of the checkboxlist control. It
works, it's just a pain that the documented property doesn't work like
it's supposed too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top