S
S
schtakelberg2016-10-16 14:05:34
ASP.NET
schtakelberg, 2016-10-16 14:05:34

viewbag. Mistake. What to do?

I do everything according to the video tutorial.
The tutorial uses VS 2010, I use Xamarin Studio

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microsoft.CSharp;
using System.Dynamic;



namespace Hotel.Controllers
{
  public class HomeController : Controller
  {
    public ViewResult Index()
    {

    
      ViewBag.VisitorNumber = new Random().Next(1, 100);
      ViewBag.DateAndTime = DateTime.Now;
      return View();
    }


  }


}

I get the error
Error CS0656: Compiler-required member 'Microsoft.CSharp.RuntimeBinder.Binder.SetMember' (CS0656) is missing.
Microsoft.CSharp has been added, the required member is present.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
@
@hatcker, 2016-10-18
_

What is happening in this code? The ViewBag itself seems to be not declared, and then it turns out that Index() return'it is the value of another method - View()'a

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question