By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,083 Members | 1,608 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,083 IT Pros & Developers. It's quick & easy.

Advice on Dynamic Controls

P: n/a
I am in need of some advice on how to do the following:

Have some type of container on form that would fill the visible area on
screen (assuming the browser was maximized). I would like to specify a
number of vertical columns that would be equally spaced. I would then like
to be able to dynamically add a variable number of various types of web
controls in a top to bottom fashion. When the maximum number of controls
placed in a column would not be visible on the screen, additional controls
would 'flow' to the next column and so on. I was able to achieve only
limited success with this using a Table control. The problem was knowing
when I had reached the maximum number of controls that would be visible,
without scrolling, on the screen and starting in the next column.

Thank you for your help.
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Steven,
Thank you for reply and sample. You've once again analyzed my question
correctly. I work with your suggestions and the attachment today and let
you know.

Thanks

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:5Y**************@cpmsftngxa07.phx.gbl...
Hi Eric,
Thanks for posting in the community!
From your description, you're wanting to dynamically add controls onto a
ASP.NET web page which will be located in a certain container control
vertically and the Container control will divide the page into serveral
equals columns. Also, you want those controls be added into the container
control from left to right in those columns and when one certain column's
sub control's total height is larger than the container's height, the
sequential ones will be added into the next column from top, yes?
If there is anything I misunderstood, please feel free to let me know.

As for this quesion, I also think the "Table" control you used is the most
proper one to perform as the container control since you can set its width
and height and dynamically add rows and cells(column). As for your problem, you can add a table control set as width="100%" height="100"% and only has
one row and one cell in that row at beginning. Then, at runtime, when it
is being added sub controls, when one cell is full in vertical height, we
can dynamically add a new column add then start adding in the new cell.

However, the problem is that when dynamically add controls, how can we know that the current TableCell is full in vertical height. Here are to cases:
1. If we set the Table's height as relative value such as "100%", then we
can't get its absolute height at runtime, we need to specify a certain
value( I think generally 500-600 is proper). When all the controls (having
been added into current tablecell)'s total height is close to this value,
then we add a new tablecell and start adding controls in that new cell.

2.If we specify the Table's Height as absolute value at begining, that'll
be much simpler, just get the table's height as the max value, and do the
determination whether to add new cell at runtime as mentioned in #1.

I've made a simple page to show the means I mentioned above and the page
code has been attached in this message. In addition, I still think the main problem is we need to get the browser's heigth. If not, we could only
specify a
fixed value as the max height of a page(the container control). Do you
think so?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2

P: n/a
Hi Eric,
I haven't heard from you. Have you had a chance to fully test on my former
suggestions or have you got any progress on this issue? If you have any
questions or need any further help, please feel free to let me know.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.