开发者

Asp.net MVC partial view

开发者 https://www.devze.com 2022-12-30 22:48 出处:网络
I want to show news on my main page using Rss Feeds. I want to show news somewhere in side panel. How i will use PartialViewsto show it?

I want to show news on my main page using Rss Feeds. I want to show news somewhere in side panel. How i will use PartialViews to show it?

    public ActionResult Feed()
    {
        string feedUrl = "http://www.gadgetfind.com/rss.xml";
        XmlReader reader = XmlReader.Create(feedUrl);
        SyndicationFeed feed = Syndi开发者_JS百科cationFeed.Load(reader);            


        return View(feed);
    }


In ASP.NET MVC 2 you can use RenderAction:

<% Html.RenderAction("Feed", "MyController"); %>

Phil Haack wrote a nice blog post about this topic.

0

精彩评论

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