1

I have created the following controller i want to add view that should have the data access class UserMagnament.Controller.menuitems but when i add view by right clicking on view folder,it is not showing "UserMagnament.Controller.menuitems" in add data class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using UserManagement.Models;

namespace UserManagement.Controllers
{
public class menuitems
{
    EvoLetDataContext db1 = new EvoLetDataContext();
    public menuitems()
    { }
    public IQueryable<UMUserType> menuitems()
    {
        return db1.UMUserTypes;
        //this.Packages = _SysPackage;  
        //this.Modules = _SysModule;  
    }
    public List<SysPackage> Packages { get; private set; }
    public List<SysModule> Modules { get; private set; }
}





public class Default1Controller : Controller
{
    //
    // GET: /Default1/

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

}

}

1 Answer 1

2

Did you rebuild your mvc application? Sometimes it helps to populate the class list when adding a View.

Sign up to request clarification or add additional context in comments.

4 Comments

No controller is shown such as homecontoller, accounts controller etc. only two controllers are visible which are "AccountsMembershipService" and "FormAuthenticaionService".
What do you mean? When you click on "Add View", the list of available classes for your strongly typed view indeed skips the controllers (AccountsMembershipService and FormAuthenticaionService are helper classes btw, not controllers). Usermanagement.Controllers.menuitems should appear in the class list without problems; once you've build your application.
yes controllers are skipped. i think i am missing something, (i have build the solution)
Its weird but truth. After creating any model class some time that model class does not get appeared in Add View dialog. but, After rebuilt it was showing me. It works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.