Can we make controller as partial controller

Yes. We can make controller as partial.

Lets create a mvc application. Now create a contolller and name it “ABCController”.
1

Now make the controller as partial.

using System.Web.Mvc;
namespace HtmlInjectInMvc.Controllers
{
    public partial class ABCController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    }
}

Now add a view and name it Index.
Now add another controller and name it xyzController.

in xyzController.cs

using System.Web.Mvc;
namespace HtmlInjectInMvc.Controllers
{
    public class xyzController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    }
    public partial class ABCController : Controller
    {
        public ActionResult About()
        {
            ViewBag.Name = "Prmaod Kumar";
            return View();
        }
    }
}

Now add a view for xyzController and name it index. Add a view and name it about.
Now run the application.
Output:
2
3

Hope enjoy this article.
Happy coding :)

Tags: ,