c# - 如何在 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");
}
解决方案
推荐阅读
- python - Pycharm 中未显示 Tkinter 窗口
- python-sphinx - 使用 autodoc 和 Sphinx 的 RTD 主题中单参数函数的项目符号列表样式?
- python - 对mac上多个版本的pip感到困惑
- php - 调用未定义的方法 PhpOffice\PhpSpreadsheet\Spreadsheet::listWorksheetNames
- python - 如何查找列表列表中的哪些项目等于另一个列表
- reactjs - React Hooks useEffect - 在执行下一个函数之前等待正在修改状态的函数
- python - 使用部分类名查找 html 元素?
- python - 如何从 Flask 应用程序的 base.html 中的搜索表单提交数据?
- python-2.7 - ExcelRobot - 机器人框架骑行 - 导入问题
- paypal - 贝宝集成 - IOS/Swift