首页 > 解决方案 > 如何在 ASP.Net 的同一页面上选择和提交数据并显示来自另一个表的数据

问题描述

当按下搜索按钮时,数据应显示在下表中。

控制器

      public ActionResult getStudentClass(int Grade, string ABC)
      {
          // int CId;
          if (!String.IsNullOrEmpty(ABC))
          {
              var items = _context.Class.Where(x => x.Grade == Grade & x.ABC == ABC).ToList();
              // CId = "";
              string CId = "";

              for (int i = 0; i <= items.Count - 1; i++)
              {
                  CId += "<tr>" +
                  "<td>" + items[i].ABC + "</td>" +
                  "<td>" + items[i].classId + "</td>" +
                  "<td>" + items[i].classMonitor + "</td>" +
                  //"<td>" + items[i]. + "</td>" +

                  "</tr>";
              }
              TempData["Table"] = CId;
          }




          return RedirectToAction("index");
      }



标签: c#asp.net.netsql-serverdatabase

解决方案


推荐阅读