-4

I have an MVC website and I'm trying to set the page as active in the controller. The result I'm getting is the ViewBag is greyed out with an underline. On hover, the message says:

Unreachable code detected

Here is my home controller

enter image description here

My using statements in the controller are:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
Nkosi
  • 235,767
  • 35
  • 427
  • 472
Chillin'
  • 172
  • 1
  • 15

1 Answers1

1

You can’t have code after the return statement. That makes it... unreachable.

Move the ViewBag assignment line to before the return View().

Chris Yeager
  • 134
  • 6
  • 1
    bloody nora you're right. Thanks. When the website will allow me, I will mark your answer as solved. Thanks! – Chillin' Mar 04 '18 at 00:49