MVC空结果 [英] MVC empty result

查看:64
本文介绍了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");
}


这篇关于MVC空结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆