add item to checkboxlist

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.
 
S

Scott M.

After you've bound the list to the datasource, add a new checkbox item to
the checkbox list using the append method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,829
Messages
2,569,737
Members
45,521
Latest member
maryb

Latest Threads

Top