Note that there are some explanatory texts on larger screens.

plurals
  1. POForce a newline <br /> while building a checkboxlist in vb.net
    primarykey
    data
    text
    <p>I'm building a checkboxlist in vb.net, and it works fine, except for the layout. I'd like to force a newline at certain points. It looks something like this now:</p> <p><img src="https://i.stack.imgur.com/2IA0m.png" alt="enter image description here"></p> <p>I'd like to force a newline after either an "ALL" checkbox, OR the "repeatColumns=4", so it would look more like this:</p> <p><img src="https://i.stack.imgur.com/zpKo8.png" alt="enter image description here"></p> <p>Can this be done in code-behind? Or maybe something on the client end in javascript ?</p> <p>This code is building the list now:</p> <pre><code> While dr.Read mTXT = dr(0) &amp; " (" &amp; dr(1) &amp; "-" &amp; dr(2) &amp; ")" LASTcnt += 1 If (dr(0) &lt;&gt; LAST) Then If (LASTcnt &gt; 0 And LAST &lt;&gt; String.Empty) Then 'add an ALL for this 'group' L = New ListItem L.Text = LAST &amp; " (ALL)" L.Value = L.Text 'L.Attributes.Add("Style", "color: red;") L.Selected = False CBL_LOC.Items.Add(L) CBL_LOC.Items(CBL_LOC.Items.Count - 1).Attributes.Add("Style", "color: red;") dt.Rows.Add(L.Text, L.Selected) End If LASTcnt = 0 LAST = dr(0) End If L = New ListItem L.Text = mTXT L.Value = mTXT L.Selected = True CBL_LOC.Items.Add(L) dt.Rows.Add(L.Text, L.Selected) End While </code></pre> <p>Here's the .aspx code that defines the checkboxes:</p> <pre><code> &lt;asp:CheckBox ID="chkAll_LOC" Text="Select All" runat="server" AutoPostBack="True" Checked="True" /&gt; &lt;asp:CheckBoxList ID="CBL_LOC" runat="server" RepeatDirection="Horizontal" onclick="CheckCheck(this)" Font-Size="Small" Font-Names="Calibri" RepeatColumns="4"&gt; &lt;/asp:CheckBoxList&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload