c# - 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 ************************************
解决方案
推荐阅读
- pip - pypdf2 和 PyPDF2 一样吗?
- javascript - ng.probe(selector) 总是导致 NULL
- r - r locf 多列和分组依据
- spring-boot - 重新启动我的 Spring Boot 应用程序后,Redis 数据在 Docker 中被删除
- python - Pandas - 创建新列,其中值取自同一数据框中的其他行
- flask - 如何将 slackapi 发布结果从 Flask 返回到 slackchannel?
- r - 使用纬度和经度匹配密码(印度)
- python - matplotlib set_yticks 去掉 imshow 的上下半行
- c++ - 参数中的前向声明与“正常”前向声明之间的区别
- angular - Angular 6 声明方法的类型