开发者

Messagebox from MVC cntroller action

开发者 https://www.devze.com 2023-04-11 09:52 出处:网络
I am new to the MVC so excuse me for asking this basic question. My requirement is simple, I have got a view where user can开发者_JS百科 provide the search criteria and then clicks the \'Search\' butt

I am new to the MVC so excuse me for asking this basic question. My requirement is simple, I have got a view where user can开发者_JS百科 provide the search criteria and then clicks the 'Search' button. If no matching records found for the entered search criteria then I need to show a message box to the user and stay at the same view.

How to do this?


Your Search action method can pass an IEnumerable<T> into the corresponding view. If the model's Count() method returns zero, you can display a message box; otherwise, you display the search results.


Sounds like AJAX is the way to go, but without specifics regarding language or framework it's hard to say more.

0

精彩评论

暂无评论...
验证码 换一张
取 消