首页 > 解决方案 > ASP.NET 显示列表在 listview 或 gridview 而不是 dropdownlist 中(Web 服务应用程序)

问题描述

下面的代码只有在我在下拉列表中显示结果时才能正常工作,但是当我尝试在标签或列表视图或网格视图中显示它时,当我用标签替换下拉列表1时它会拒绝。有人可以告诉我怎么做吗?

   TenderNotificationInfo[] noticeInfo = returnVo.tenderNotificationInfo;

            int len = noticeInfo.Length;

            List<CTendNotificationInfo> tendInfo = new List<CTendNotificationInfo>();
            List<LotInfo> lot = new List<LotInfo>();

            CTendNotificationInfo tend_curr = new CTendNotificationInfo();
            //LotInfo lot_curr = new LotInfo();
            for (int i = 0; i < len; i++)
            {

                tend_curr.PENAME = noticeInfo[i].tenderRefNumber;
                tend_curr.PECODE = noticeInfo[i].tenderRefName;
                tendInfo.Add(tend_curr);

                TenderLOTInfo[] lotInfo = noticeInfo[i].tenderLOTInfo;
                int size = lotInfo.Length;

                if (size != 0)
                {
                    for (int j = 0; j < size; j++)
                    {
                        lot.Add(new LotInfo()
                        {
                            LOTNO = lotInfo[j].tenderLotNumber,
                            LOTNAME = lotInfo[j].tenderLotName,

                        });
                    }
                }
            }

            Session.Add("tendInfo", tendInfo);
            Session.Add("lot", lot);

            //begin of displaying in DropDownList1 *****************************************************************************
            DropDownList1.DataSource = tendInfo;
            DropDownList1.DataTextField = "DEADLINE";// TENDREFNAME";
            DropDownList1.DataValueField = "TENDREFNUM";
            DropDownList1.DataBind(); //end of displaying in DropDownList1 ************************************

标签: c#asp.netweb-serviceswebservice-client

解决方案


推荐阅读