Reputation: 423
I have a table with 1 row and 3 columns. But the columns are not aligned properly. It is displayed as follows:
Table _tbRequiredDocFormat = new Table();
TableRow row_requiredDocCount = new TableRow();
TableCell cellLabel = new TableCell();
TableCell cellFileInput = new TableCell();
TableCell cellBtn = new TableCell();
//add label, RadAsyncUpload and Button to cells.//
//formatting as below::
this._tbRequiredDocFormat.Rows[requiredDocCount].Cells[0].Width = Unit.Percentage(30);
this._tbRequiredDocFormat.Rows[requiredDocCount].Cells[0].HorizontalAlign = HorizontalAlign.Right;
this._tbRequiredDocFormat.Rows[requiredDocCount].Cells[0].VerticalAlign = VerticalAlign.Middle;
this._tbRequiredDocFormat.Rows[requiredDocCount].Cells[1].HorizontalAlign = HorizontalAlign.Left;
this._tbRequiredDocFormat.Rows[requiredDocCount].Cells[1].VerticalAlign = VerticalAlign.Middle;
this._tbRequiredDocFormat.Rows[requiredDocCount].Cells[2].HorizontalAlign = HorizontalAlign.Left;
this._tbRequiredDocFormat.Rows[requiredDocCount].Cells[2].VerticalAlign = VerticalAlign.Middle;
Despite all attempts, I cant bring the cells closer. I want the table in the center and the cells closer to each other so that it looks better. Please suggest a solution.
Upvotes: 0
Views: 120
Reputation: 2111
Looks like your table is using 100% of the available width, so you may want to reduce that, ie: _tbRequiredDocFormat.Width = 400
. Check your CSS isn't applying some styling that's causing this. If that's not the solution can post the raw html?
To align your table add the style: margin: 0px auto;
But as this is a control you're building up you'll have to create a CCS Class and call that, for example: _tbRequiredDocFormat.CssClass = "CenterTable";
Upvotes: 1