Set Location of control programatically

  • Thread starter Thread starter Nikolay Podkolzin
  • Start date Start date
N

Nikolay Podkolzin

Goon afternoon, Community! I'm sorry for a post in wrong place, but couldn't
find more appropriate place for that.



Could you be so kind and help me with dynamic creating controls in asp.net.
I need to set a positions of control programaticall.



How could I do that?



Thanks In advance.

Best Regards, Nikolay
 
Nikolay Podkolzin said:
Could you be so kind and help me with dynamic creating controls in
asp.net.
I need to set a positions of control programatically.

In ASP.NET your servers controls are going to produce HTML which is then
sent to the browser. It is the browser the one that interprets the HTML and
positions the controls according to the contents. Therefore, you need to
think about what kind of HTML you want to generate, and write server code
that produces that HTML.
For instance, one way to position the controls on screen is to generate a
TABLE and then place your controls inside the cells of the table. When
generating this on the server side, you would create HtmlTableCell controls
which you would add to the Cells collection of your HtmlTableRow controls,
which you add to the Rows collection of a HtmlTable. All of them can be
dynamically created as server controls.
Another way is to add a Style to the controls you are producing, and
write a "position:absolute;top:30px;left:80px;" (for instance) inside the
Style. Be warned that this position is relative to the container of the
control.
 

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

Back
Top