asp.net mvc key Tutorial first-year fifth back ActionResult other return values

Source: Internet
Author: User

The action we see above is return View (), and we can look at it as a value for parsing an ASPX file. And its return type is actionresult as

public ActionResult Index()
{
return View();
}

Besides view () what value can we use here to return?

One, ascx page

Scenario: To return a snippet of code, such as Ajax, to return a child page

Let's start with a new action.

public ActionResult Ascx()
{
return PartialView ();
}

We'll build a view below, and still be right in the Action Center, AddView.

 

Note that the figure is checked.

So I created a new ascx page, and we'll rewrite it a little bit.

<%@ Control  Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<div>
得到一个DIV
</div>

Run, get the page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.