troubleshooting Question

list box not getting values APS.NET C#

Avatar of copyPasteGhost
copyPasteGhostFlag for Canada asked on
.NET ProgrammingASP.NET
4 Comments1 Solution502 ViewsLast Modified:
I have a listbox called lbConds.

it contains 4 items.


the selection mode is multiple

When I select the items and submit the page I can't seem to trap which items where selected...

this is what I'm doing...


protected void btnPreview_Click(object sender, EventArgs e) {
ListItemCollection myConds = null;
        int[] selectedConds = lbCond.GetSelectedIndices();
        if (lbCond.GetSelectedIndices().Length > 0) {
            for (int i = 0; i < selectedConds.Length; i++) {


<asp:Button id="btnPreview" CausesValidation="False" runat="server" style="z-index: 107; left: 237px; position: absolute;
            top: 550px; width: 130px;" width="100px" OnClick="btnPreview_Click" />

<asp:ListBox ID="lbCond" runat="server" DataTextField="CondText" DataValueField="EnglishID"
            Height="193px" SelectionMode="Multiple" Style="z-index: 122; left: 238px; position: absolute;
            top: 272px"></asp:ListBox>

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros