strongly-typed-view

MEF and MVC 3 - how to load embedded views dynamically from mef container?

那年仲夏 提交于 2020-01-01 02:30:12
问题 I'm building an MVC 3 application where MEF is used. The main idea is to have plug-in mechanism where models, controllers and views are loaded dynamically during runtime from mef container. Each plugin/module consists of two assemblies: Module1.Data.dll (contains definitions of models) Module1.Web.dll (contains controllers and views) and are put in the Plugins directory inside web application bin: WebApp/Bin/Plugins/Module1.Data.dll WebApp/Bin/Plugins/Module1.Web.dll WebApp/Bin/Plugins

UmbracoTemplatePage and strongly typed view not working together

微笑、不失礼 提交于 2019-12-25 02:25:35
问题 I don't quite understand why I can't use both strongly typed view and umbraco template in one view. I have a script importing excel data. My website is in umbraco 7. I use Import.cshtml view which calls upload.cshtml partial @inherits UmbracoTemplatePage @{ Layout = "~/Views/Master.cshtml"; var locations = new List<SelectListItem> { new SelectListItem {Selected = false, Text = "location 1", Value = ""}, }; var fileTypes = new List<SelectListItem> { new SelectListItem {Selected = false, Text =

ASP.NET MVC strongly typed view compilation error

微笑、不失礼 提交于 2019-12-23 12:58:56
问题 This is a strange one. I changed something (not sure what) and now my app's view doesn't compile at runtime. The view itself is strongly typed: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MyNamespace.OperatorModel>" %> When I visit the page, it fails to compile, saying: CS1061: 'object' does not contain a definition for 'Log' and no extension method 'Log' accepting a first argument of type 'object' could be found (are you missing a

Single strongly Typed Partial View for two similar classes of different types

﹥>﹥吖頭↗ 提交于 2019-12-13 19:07:28
问题 I have a Register Primary View which shows two different types of Addresses 1. Home Address 2. Mailing Address public class RegisterModel { public AddressModel HomeAddress { get; set; } public AddressModel MailAddress { get; set; } } public class AddressModel { public string Street1 { get; set; } public string Street2 { get; set; } public string State { get; set; } public string City { get; set; } } My main Register View is Strongly Typed to RegisterModel as follows @model MyNamespace.Models

Pass data to Master Page with ASP.NET MVC

不问归期 提交于 2019-12-11 14:54:16
问题 I have a hybrid ASP.NET WebForms/MVC project. In my Master Page, I have a "menu" User Control and a "footer" User Control. Anyways. I need to pass some data (2 strings) to my "menu" User Control on my Master Page (to select the current tab in my menu navigation, etc.) My views are strongly-typed to my data model. How can I push data from my controller to my menu or at least allow my master page to access some data pre-defined in my controller? Note: I understand this violates pure ASP.NET MVC

object Model types in MVC2 using strongly typed view pages problem

醉酒当歌 提交于 2019-12-11 01:36:04
问题 I have a new converted MVC2 project running against the MVC2 source code. I have done this conversation twice on the same solution. I use strongly typed views on every page of the site and so far I haven't had any issues running against the source nor developing with strongly typed views. Now on one strongly typed view in particular the generic parameter is not being reflected in the Model property of that page. Instead of having a Model of type T I always have a Model of type object. The

T4MVC or MvcFutures for strongly typed links in views

安稳与你 提交于 2019-12-10 21:14:15
问题 I am trying to reduce/eliminate "magic strings" from my MVC3 project and was wondering which approach would be better: use MvcFutures and do something like: var title = "Create New Customer"; Html.ActionLink (c => c.Create(), title , new { @class = "button", title = title }); use T4MVC Which option is more flexible, more performant, easier when refactoring, etc, etc? Thoughts? 回答1: T4MVC, no contest. It let's you reference views and controller actions using a hierarchy of (code-generated)

ASP.NET MVC3, why does dropdownlist rely on viewbag even in a strongly typed view

人盡茶涼 提交于 2019-12-08 21:03:54
问题 I'm new to MVC, so maybe this is a stupid question - I'm trying to get my head around strongly typed views in asp.net mvc. I'm working on version 3. If I have a project with 2 models - say Person and Department. A person must belong to a department. So I have my Department model (and I've generated my controller and CRUD interface): public class Department { public int Id { get; set;} public string DeparmentName { get; set;} } Then I have a Person model which references Department: public

Asp.Net MVC - Strongly Typed View with Two Lists of Same Type

做~自己de王妃 提交于 2019-12-07 05:42:24
问题 I have a View strongly typed to an Item class. In my controller I need to send two different List. Is there an easier way to do this other than creating a new class with two List. What I am ultimately trying to do is have on my homepage 10 items ordered by Date, and 10 items ordered by Popularity. WHAT I DID I actually went with a combination of the two answers. I strongly-typed my View to the new class I created with the two lists. I then strongly-typed two partial views to the each one of

How come internal members in my view model aren't accessible in the view?

我的未来我决定 提交于 2019-12-07 03:09:47
问题 I have some internal automatic properties in my view model but my strongly-typed view doesn't see them. Everything is in the same assembly, so why is this happening? public class MyViewModel { public int PublicProperty { get; set; } internal int InternalProperty { get; set; } } . @*My view*@ @model MyViewModel @Model.PublicProperty @Model.InternalProperty @*Causes compilation error*@ 回答1: Views are compiled in a separate dynamically generated assembly by the ASP.NET runtime. So you cannot use