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

Staff online

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top