I am using C# visual studio 2010 to develop an ASP.NET website.
I dynamically create a checkbox at run time.
CheckBox chkbox = new CheckBox();
chkbox.ID = "chk" + checkboxID;
// Add our checkbox to the panel
dynamicPanel.Controls.Add(chkbox);
chkbox.Text = checkboxName;
By default, the label is displayed to the right of the checkbox. I can successfully move the label from side to side by adjusting chkbox.TextAlign = TextAlign.Right / Left.
What I can not figure out for the life of me is how to set the Text above the check box.
I am not looking for any kind of hack like, verticle-align:-3px as this will not work for me because I let the user pick the font and size of the text. It will not always be -3px in depth.
Set the text align property to TextAlign.Left then use CSS to set the label’s display to: block.