Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 575015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:53:34+00:00 2026-05-13T13:53:34+00:00

I am using MVC preview 2 framework to develop web sites and I am

  • 0

I am using MVC preview 2 framework to develop web sites and I am following MVCStorefront tutorials to get a good feel on MVC.

Can you tell me why I can’t use RenderView() method ?

Am I missing something or can I use View() instead ?
What’s the difference between these methods..

Thanks

Here is where Rob is using RenderView in his tutorial.

[TestMethod]
    public void CatalogController_IndexMethod_ShouldReturn_Categories_And_Data_For_Parent1() {

        CatalogController c = new CatalogController(_repository);

        RenderViewResult result = (RenderViewResult)c.Index("Parent1", "Sub10");

        CatalogController.CatalogData data = (CatalogController.CatalogData)result.ViewData;

        Assert.IsNotNull(data.Category);
        Assert.IsNotNull(data.SubCategory);
        Assert.IsNotNull(data.SubCategory.Products);
        Assert.IsTrue(data.SubCategory.Products.Count() > 0);

        Assert.IsNotNull(result);
    }

I can’t use RenderView. It says ” the name ‘RenderView’ does not exist in the current context

Here’s the link :
http://www.asp.net/learn/mvc-videos/video-357.aspx

Here is an index method from the CatalogController class :

public ActionResult Index(string category, string subcategory) {

        //instantiate the service
        CatalogService svc = new CatalogService(_repository);

        //the ViewData class
        CatalogData data = new CatalogData();

        //pull all the categories for the navigation
        data.Categories = svc.GetCategories();

        //pull the category based on subcategory name
        data.Category = data.Categories.WithCategoryName(category);

        //catch for bad data
        if (data.Category == null) {

            data.Category = data.Categories.DefaultCategory();

            data.SubCategory = data.Category.SubCategories[0];

        } else {

            data.SubCategory = data.Categories.WithCategoryName(subcategory);

            //catch for bad SubCategory
            data.SubCategory= data.SubCategory ?? data.Category.SubCategories[0];

        }
        return RenderView("Index",data);
    }

I am also having a problem with the casting of result.ViewData in CatalogData type which is class that contains data. It says : Cannot convert type System.Web.Mvc.ViewDataDictionary to Commerce.MVC.Web.Controllers.CatalogController.CatalogData

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:53:34+00:00Added an answer on May 13, 2026 at 1:53 pm

    The video you are watching is unfortunately outdated – it is from ASP.NET MVC 1.0 Preview 2. Since then ASP.NET MVC 1.0 RTM has shipped and there are previews of ASP.NET MVC 2 available.

    In ASP.NET MVC 1.0 Preview 2 and earlier action methods returned ‘void’ so they had to explicitly perform a result, such as render a view:

    public void Index() {
        // do some work...
        RenderView("Index");
    }
    

    In ASP.NET MVC 1.0 Preview 3 (Refresh?) and newer, action methods return a result object, which then actually performs the result:

    public ActionResult Index() {
        // do some work...
        return View("Index");
        // or you could also just say "return View();" and MVC figures out the view name
    }
    

    The main reason this changed is that it allows for much better unit testing. Action methods now only perform the “application logic” and don’t worry about exactly how to render a view. The unit test can simply inspect the results of the application logic and then verify that the next desired step was “render a view.”

    A lot of type names and method names have changed as well to make them shorter and simpler to use. For example, RenderView is just View and RenderViewResult is just RenderView.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 303k
  • Answers 303k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Youre simply getting a pointer that contains the address of… May 13, 2026 at 8:41 pm
  • Editorial Team
    Editorial Team added an answer LINQ-to-NHibernate currently does not support subqueries or joins: http://ayende.com/Blog/archive/2009/07/26/nhibernate-linq-1.0-released.aspx May 13, 2026 at 8:41 pm
  • Editorial Team
    Editorial Team added an answer I don't really know what you're talking about, and even… May 13, 2026 at 8:41 pm

Related Questions

hi i am trying to create a URL that looks like this: black/granite/worktops where
I am using ASP.NET MVC 2 Preview 2 and have written a custom HtmlHelper
I am working a little project for myself using ASP.Net MVC 2 Preview 2
I am trying to implement a session-per-request pattern in an ASP.NET MVC 2 Preview
One of the new features in ASP.NET MVC 2 Preview 1 is support for

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.