I have a dynamically created checkbox from code behind that has a long label on my webform asp.net project. When the text wraps to a new line the new line of text starts directly under the checkbox itself. How can I dynamically set the checkbox so the new line is automatically indented if needed. Not all dynamically created checkboxes have a long label.
Here is my code that creates the checkbox:
MyObject obj = SetNewObject("Supervisor");
CheckBox objCheck6 = new CheckBox();
objCheck6.ID = obj.GetFieldValue("Name");
objCheck6.Text = GetControlTitle("Supervisor");
objCheck6.Checked = obj.GetFieldValue("Value").ToLower() == "true";
tableCell1.Controls.Add(objCheck6);
I have tried a couple things that have not worked. I tried the following, one at a time and each seemed to have zero effect on the checkbox or checkbox's text at all:
objCheck6.Style.Add("margin-left", "20px");
objCheck6.LabelAttributes.Add("margin-left", "20px");
objCheck6.TextAlign = TextAlign.Right;
objCheck6.TextAlign = TextAlign.Left;
A point in the right direction would be much appreciated. Thanks!
Aucun commentaire:
Enregistrer un commentaire