Reputation: 423
I have a table which has a label in the 1st row and a DateTimePicker
in the 2nd row as follows:
Table _Table = new Table();
TableRow row1 = new TableRow();
TableRow row2 = new TableRow();
this._Table.Rows.Add(row1);
this._Table.Rows.Add(row2);
TableCell dateCell = new TableCell();
TableCell labelCell = new TableCell();
labelCell.VerticalAlign = VerticalAlign.Bottom;
labelCell.HorizontalAlign = HorizontalAlign.Right;
dateCell.Controls.Add(_DtProposalSigned);
labelCell.Controls.Add(savedLabel);
row1.Cells.Add(labelCell);
row2.Cells.Add(dateCell);
I am trying to align the label cell so that label is to the right, above the DateTimePicker
, but I get the result as follows (Label
in the center), though I have aligned it to the right!
Upvotes: 1
Views: 3905
Reputation: 1384
I tried the same code and it's working perfect for me. So, here is a check list you may give a try.
width
anywhere for 'savedLabel' or Text/innerHTML
of savedLabel
width
property of labelCell
savedLabel
like <div>Saved<div>
then make sure that you haven't given it a fixed width like <div style='width:100px;'>Saved</div>
Saved!
and then selecting Inspect Element
. Examine the <span></span>
element rendered for the label and I am sure, you will be able to find the exact issue and hence the solution.In case these are not helpful, please let me know.
Upvotes: 4