Manoj Nayak
Manoj Nayak

Reputation: 2509

How to add the checkbox item at the new line?

I have a checkbox list like below:

<asp:CheckBoxList  id="chx" runat="server" repeatdirection="Horizontal"> <asp:ListItem value="OPTION1">Option 1</asp:ListItem>
<asp:ListItem value="OPTION2">Option 2</asp:ListItem>
<asp:ListItem value="OPTION3">Option 3</asp:ListItem><
asp:ListItem value="OPTION4">Option 4</asp:ListItem>
</asp:CheckBoxList>

And I am dynamically adding the list items to this checkbox using the following C# code:

chx.Items.Clear();
while(dr.Read()){
    if(dr.GetOracleString(0).ToString()!="Null"){
        chx.Items.Add(dr.GetOracleString(0).ToString());
    }
}

My requirement is whenever the new item is added in the checkboxlist, it should check whether the new item is going beyond the border(fixed width) of the page and if so the new item should go the next line of checkboxlist without overlapping below control.
Please help me to fix this. enter image description here

Upvotes: 1

Views: 2012

Answers (1)

Edi G.
Edi G.

Reputation: 2420

You can use the property RepeatColumns

RepeatColumns="3"

Upvotes: 4

Related Questions