在判断ViewData[""]是否为空时,需将ViewData[""]转换为相应的类型,在判断其Count()属性是否为0,来判断是否存有值

 如:<% if ((ViewData["subDepartmentsAndAmount"] as Dictionary<YouXieKu.Models.Department, int>).Count()!=0){ %>

而不能 直接通过 ViewData["subDepartmentsAndAmount"]!=null 抑或 (ViewData["subDepartmentsAndAmount"] as Dictionary<YouXieKu.Models.Department, int>)!=null

相关文章:

  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-04
  • 2021-11-27
  • 2021-11-28
  • 2021-11-28
  • 2021-07-04
  • 2021-06-11
  • 2021-06-08
相关资源
相似解决方案