Sizing and positioning of dynamic controls

T

Tim Marsden

Hi

I would like to add controls to my page at runtime.
What containers can I use to host the controls?
I know I can add them to the form controls collection, but I need to have
control on where they are placed. For example I would like a page header and
footer, menu on the left, text on the right and an area in the middle where
I can add the controls, with the area sizing dynamically.

Hope you can suggest some options.

Tim
 
S

Steven Cheng[MSFT]

Hi Tim,


Thanks for posting in the community!
From your description, you're looking for some proper container controls to
hold in the ASP.NET web page so as to contain some other dynamically added
controls, yes?
If there is anything I misunderstood, please feel free to let me know.

As for this question, I think the PlaceHolder, Panel or html Div control
are all capable of doing this. But the PlaceHolder is more recommended. And
here are some references on them:

#PlaceHolder Web Server Control
http://msdn.microsoft.com/library/en-us/vbcon/html/vboriplaceholderwebserver
control.asp?frame=true

#Panel Web Server Control
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconpanelwebcontrol.asp?
frame=true

Also, some additional tech meterials on dynamicaly adding server controls
on ASP.NET WEB FORM:
#Adding Controls to a Web Forms Page Programmatically
http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskaddingcontrolstowebf
ormspageprogrammatically.asp?frame=true

Hope these helpful.



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
 
T

Tim Marsden

Steven

Thanks,

I have had a go at using place holders and panels, within a html table. If I
am clever at setting the widths of the controls I can achieve the results I
am after, that is controls in a vertical list, but it is not easy. I have
not been able to position absolutely within the panel or place holder.

FYI, I am trying to achieve varying number of rows of controls. Each row
will contain 3 columns, a label , a text box (or combo box) and a icon.


Tim
 
S

Steven Cheng[MSFT]

Hi Tim,

Thanks for your followup.
Yes, as you mentioned, to get and set the web control's width and heigth
are not quite easy especially to get them because a certain control in page
will derived its height and width from its parent container element
especially you explictly set them.

In addition, as for the:
"I am trying to achieve varying number of rows of controls. Each row
will contain 3 columns, a label , a text box (or combo box) and a icon."
you mentioned in last reply, do you mean that you'll dynamically add
several rows of controls and each row will contain three cell(has a certain
sub control in it)? If so, do you think it possbile to use the ASP.NET
Table control? We can dynamically add rows into Table Control also add
cells into each row dynamically. Here is the reference of Asp.net Table
server control in MSDN:

#Table, TableRow, and TableCell Web Server Controls
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconTableTableRowTableCe
llWebControls.asp?frame=true



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
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top