add item to checkboxlist

  • Thread starter Thread starter E. Kwong
  • Start date Start date
E

E. Kwong

I want to add a single item "Other" to a checkboxlist whose data comes from
a query of a database table. I have the checkboxlist coded like this:

<asp:CheckBoxList ID="chkblItems" runat="server" DataSourceID="srcItems"
AppendDataBoundItems="true"

DataTextField="ItemName" DataValueField="ItemID" RepeatColumns="3"
RepeatDirection="Horizontal">

<asp:ListItem Text="Other" />

</asp:CheckBoxList>

However; "Other" appears as the first item in the list when the program is
run. Is there any way to make it the LAST item on the list? I thought of
adding "Other" to the database table but then it would come out in the
middle of the listing since the query is sorted alphabetically.

If there's no other way, I guess I have to make "Other" a separate checkbox.

Thanks for any suggestion.
 
After you've bound the list to the datasource, add a new checkbox item to
the checkbox list using the append method.
 
Back
Top