locked
how to sort collection and add values to CheckBoxList sorted RRS feed

  • Question

  • Hi
    I have this in the page for my CheckBoxList
     <table cellspacing="0" style="height: 100%;" width="100%" cellpadding="0">
            <tr >
                <td class="blueOnGreyText" width="100%" >
                    <asp:CheckBoxList ID="chkLst"  runat="server" 
                        RepeatDirection="Horizontal" RepeatColumns="3">
                    </asp:CheckBoxList>
                </td>
            </tr>
        </table>


    In My code i have a collection ReferenceCode
    This is what i use currently to add the values to the list.

    I need to
    • Sort the data i get
    • Add description and value to the list

     ReferenceCode[] _col = _bllRefCodes.GetReferenceCodes("tested_drug_code_id")._collection;


                    for (int i = 0; i <= _col.GetUpperBound(0); i++)
                    {
                                      
                        chkLst.Items.Add(_col[i].Description);
                    }

    Plz provide help on that
    --------------------------
    Tried this tooo but no sorting:
         BLLReferenceCode _bllRefCodes = new BLLReferenceCode();
                    ReferenceCode[] _col = _bllRefCodes.GetReferenceCodes("tested_drug_code_id")._collection;


                    for (int i = 0; i <= _col.GetUpperBound(0); i++)
                    {

                        // Create new row and add it to the table.
                        chkLst.Items.Add(new ListItem(_col[i].Description, _col[i].ReferenceCodeId.ToString()));
                        
                    }
    • Moved by nobugz Tuesday, September 15, 2009 2:34 PM forums.asp.net (From:.NET Base Class Library)
    • Changed type jojykk Tuesday, September 15, 2009 3:49 PM
    • Edited by jojykk Tuesday, September 15, 2009 5:53 PM Edited
    Tuesday, September 15, 2009 2:03 PM

Answers

  • Hello ,

     

    Thank you for your post!  I would suggest posting your question in the ASP forums located here:  http://forums.asp.net  


    Have a great day!

    Thanks!


    SachinW Tier 2 Application Support Server and Tools Online Engineering Live Services Team
    • Proposed as answer by SachinW Wednesday, September 16, 2009 12:08 PM
    • Marked as answer by SachinW Thursday, February 11, 2010 8:50 AM
    Wednesday, September 16, 2009 12:08 PM

All replies

  • Hello ,

     

    Thank you for your post!  I would suggest posting your question in the ASP forums located here:  http://forums.asp.net  


    Have a great day!

    Thanks!


    SachinW Tier 2 Application Support Server and Tools Online Engineering Live Services Team
    • Proposed as answer by SachinW Wednesday, September 16, 2009 12:08 PM
    • Marked as answer by SachinW Thursday, February 11, 2010 8:50 AM
    Wednesday, September 16, 2009 12:08 PM
  • This is a C# .net question!!
    Wednesday, September 16, 2009 6:33 PM