在dropdownlist + split中绑定

时间:2011-10-10 02:00:33

标签: c#

    public List<Data.ListBoxData> Size()
    {
        List<Data.ListBoxData> result;
        Data.ListBoxData data;
        result = new List<Data.ListBoxData>();
        var query = from a in base.MyEntities.style_sz select new { a.id, a.size };

        foreach (var itm in query)
        {
            data = new Data.ListBoxData();
            data.DisplayText = itm.size.ToString();
            data.ValueText = itm.size.ToString();

            ArrayList list1 = new ArrayList(itm.size.ToArray());

           foreach (var itm in query)
        {
            data = new Data.ListBoxData();
            data.DisplayText = itm.size.ToString();
            data.ValueText = itm.size.ToString();

            ArrayList list1 = new ArrayList(itm.size.Split(','));

            foreach (string i in list1)
            {
                string tempo = i;
                data.DisplayText = tempo;
                data.ValueText = tempo;
                result.Add(data);

            }

        }
        return result;
 }

我遇到一个问题 当我绑定下拉列表时,我遇到一个问题 结果应该是1,2,3,4,5,6,7,8,9 但我得到3,3,3 6,6,6,9,9,9 我正在使用拆分 有谁引导我?

0 个答案:

没有答案