I use Umbraco 4.7.
I have a page of news - NewsPage
with 3 functionalities:
a) display the list of news (3 max on first page, module NewsList.cshtml
),
b) "display detail of a news" in a popup (template Ajax\\Popup.cshtml
), and
c) "display more news" (displays the next 3 news on the list).
As I don't know how to use 2 Ajax templates for the same page (one for popup and one for more news),
I would like to use the same module ( NewsList ) to display "next 3 news".
How, in the NewsList.cshtml
, to make difference between a normal "get" and an "Ajax get"?
In NewsList.cshtml, add this:
@{
var isAjax = Request.IsAjaxRequest();
}
Then you can use the "isAjax" variable in your Razor code to change the output.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.