ASP.Net add controls to panel - align horizontally

Posted on 2013-06-10
Last Modified: 2013-06-11
I'm creating a control programmatically - added a panel then a toolbar and other controls.
But the controls alway render vertically - l've tried apply a css but doesn't seem to work
how can I render the control on the panel horizontally?

 Panel panel = new Panel();
            panel.HorizontalAlign = HorizontalAlign.Left;
            panel.Height = 30;

            btn = new  Button();
            btn.Text = "Add ";
            btn.Height = Unit.Pixel(30);
            btn.Width = Unit.Pixel(100);

       btn = new  Button();
            btn.Text = "Delete ";
            btn.Height = Unit.Pixel(30);
            btn.Width = Unit.Pixel(100);


Question by:JElster
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 14

Accepted Solution

dejaanbu earned 400 total points
ID: 39236774
consider adding a dynamic htmltable , and then add the buttons to the cells of table rows.
Table tbl = new Table();
TableRow tr = new TableRow();
TableCell tc = new TableCell();

btn = new  Button();
            btn.Text = "Add ";
            btn.Height = Unit.Pixel(30);
            btn.Width = Unit.Pixel(100);




Open in new window

LVL 25

Expert Comment

ID: 39238434
Sorry but I disagree with that idea - tables are not meant for general control layout unless tabular data is required.

First make sure your panel is wide enough to allow controls to sit side-by-side.  I assume you've removed some code from your example for brevity, so the next job is to remove all CSS from the panel and buttons.

Can you post a screen grab after that if you still have problems?

Author Comment

ID: 39238629
Code is a simple as that... no CSS
buttons appear vertical on top of each other.

Author Closing Comment

ID: 39238647
that worked

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question