We help IT Professionals succeed at work.

How align text of checkboxlist control in ASP.Net?

1,265 Views
Last Modified: 2012-05-11
I want text in my checkbox list to align right to the checkbox. Somehow it is not align to the right, it is being displayed in the bottom, did i miss something?
----------------
<asp:CheckBoxlist ID="chkLst" runat="server" TextAlign="Right"
      AutoPostBack="True" ></asp:CheckBoxlist>
-----------------
I am populating my list items programmatically from the dataset
-----------------
Dim Row As DataRow
            If Not DS Is Nothing Then
                  If DS.Tables.Count > 0 Then
                        If DS.Tables(0).Rows.Count > 0 Then
                              For Each Row In DS.Tables(0).Rows
                                    Dim li As New ListItem()
                                    li.Text = Row("NAME").ToString.Trim
                                    chkLst.Items.Add(li)
                                    chkLst.TextAlign = TextAlign.Right
                              Next
                        End If
                  End If
            End If
            DS.Dispose()
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I added  Width="266px" for <asp:CheckBoxList> but still it is doing same
Rajar AhmedConsultant
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Data table is populated from a select SQL. Number of rows in the dataset may vary for me to use
chkLst.RepeatColumns = 2

Author

Commented:
I already have the RepeaterDirection=Horizontal in the properties window of the checkboxlist.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
It was prob. with my CSS file, thank for the help.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.