MVC空结果
问题描述:
你好朋友,
我有一个问题,我只想在控制器返回至少一行时才在mvc视图中运行一些代码,意思是不应该为空.我该如何检查?
我在自己的视图中使用自定义表单.
我可以检查吗.mvc
Hello friends,
I am having a problem that I want to run some code inside mvc view only when controller return at least one row, mean is should not empty. How can i check this?
Im using custom form in my view.
Can i check this.mvc
答
您不能检查结果,仅在需要调用其他视图(例如
)时调用该视图
if(rowcount> = 1){
return view();
}
其他{
RedirectToAction("index");
}
can''t you check the result and only call the view if you need to otherwise call another view such as
if ( rowcount >= 1) {
return view();
}
else {
RedirectToAction("index");
}