草庐IT

view_type_t

全部标签

c# - 如何通过 Ajax Begin 表单正确使用分部 View

我的index.cshtml中有以下代码@usingKendo.Mvc.UI;@usingxx.Relacionamiento.Modelo.Bussiness.Entities;@usingxx.Relacionamiento.Modelo.Bussiness.Entities.Custom;@modelPresupuestosGenerale@{ViewBag.Title="Index";Layout="~/Views/Shared/_Layout.cshtml";}@Html.Partial("CreateOrEditPresupuestoGeneralxx",Model)然后我

c# - 从局部 View 向页面的 <head> 添加 CSS 引用

有没有办法从局部View向页面添加CSS引用,并让它们呈现在页面的中?(根据HTML4.01spec的要求)? 最佳答案 如果您使用的是MVC3和Razor,将每页项目添加到您的部分的最佳方法是:1)从布局页面中调用RenderSection()2)在您的子页面中声明相应的部分:/Views/Shared/_Layout.cshtml:@RenderSection("HeadArea")/Views/Entries/Index.cshtml:@sectionHeadArea{}生成的HTML页面包含一个如下所示的部分:

c# - MVC 在 View 模型中使用领域模型

是否可以执行以下操作?我知道域模型不应该在View中使用,但是可以在View模型中使用域模型吗?对于一些非常小的模型,为它们创建和管理View模型似乎不值得。例如publicclassLoginDomainModel{publicstringEmail{get;set;}publicstringPassword{get;set;}publicstringDisplayName{get;set;}publiclongUserTypeID{get;set;}publicvirtualUserTypeUserType{get;set;}}publicclassUserTypeDomainMo

c# - 在 View 模型中使用 ICommand 可以吗

大多数WPFmvvm应用程序,我们在View模型中使用ICommand。但它指的是System.Windows.Input。所以View模型现在与System.Windows.Input命名空间紧密结合。根据我的理解,View模型应该能够在普通的C#winform应用程序或asp.net应用程序中使用。通常我们使用以下代码行来执行RelayCommand实现的命令。privateRelayCommandtestCommand;//orprivateICommandtestCommand;publicICommandTestCommand{get{returntestCommand??(

c# - 在大型应用程序中使用 MVVM - 共享 View 模型、模型、状态等

我想知道你们中是否有人知道一些很好的教程来解释大型应用程序的MVVM。我发现关于MVVM的每个教程都只是基础知识解释(如何实现模型、View模型和View),但我对在应用程序页面之间传递数据、在哪里初始化View模型、在哪里存储常见应用程序的技术和模式感到好奇数据(在多个View模型之间共享)等。我更喜欢没有任何MVVM框架(MVVMLight等)的纯c#/XAML解决方案。 最佳答案 techniquesandpatternswhenitcomestopassingdatabetweenapplicationpages如果数据传递

c# - Prism,将 Views 和 ViewModels 与 Unity 连接起来,试图理解它

CreatingtheViewandViewModelUsingUnityUsingUnityasyourdependencyinjectioncontainerissimilartousingMEF,andbothproperty-basedandconstructor-basedinjectionaresupported.Theprincipaldifferenceisthatthetypesaretypicallynotimplicitlydiscoveredatruntime;instead,theyhavetoberegisteredwiththecontainer.Typi

c# - "Both use the XML type name X, use XML attributes to specify a unique XML name and/or namespace for the type"怎么解决?

我有以下枚举定义...namespaceItemTable{publicenumDisplayMode{Tiles,Default}}namespaceEffectiveItemPermissionTable{publicenumDisplayMode{Tree,FullPaths}}...然后我有以下类(class)...publicclassTablewhereTDisplayMode:struct{//publicpublicTDisplayModeDisplayMode{get{returnmDisplayMode;}set{mDisplayMode=value;}}//pri

c# - 在代码隐藏事件中调用 View 模型方法是否会破坏 MVVM?

我想知道这是否会破坏MVVM模式,如果会,为什么会如此糟糕?WPF:代码隐藏:privatevoidButton_Click(objectsender,RoutedEventArgse){ViewModel.CallMethod();}查看模型:publicvoidCallMethod(){//Somecode}恕我直言,它使后台代码非常简单,View模型仍然不知道View和后台代码,并且对View的更改不会影响业务逻辑。在我看来,它比Commands或CallMethodAction更简单明了。我不想要那种“这不是应该怎么做”的回答。我需要一个适当且合乎逻辑的理由来说明为什么这样做会

c# - IServiceLocator.GetInstance(Type) 的意图与 IServiceProvider.GetService(Type) 的意图有何不同?

方法签名的意图是否存在差异IServiceProvider.GetService(TypeserviceType)和IServiceLocator.GetInstance(TypeserviceType)?如果有,区别是什么?我一直将它们视为等同的,但为了保持一致性,我选择使用单一方法。对于处理这两个接口(interface)来说,这似乎是一个足够好的解决方案,但我真的很想知道它们的实际用途是怎样的,这样我就可以确定我在正确的地方使用了正确的接口(interface)。如果他们的意图实际上是相同的,那么是否有任何理由为了同一目的而使用多组语义?(我理解theGetInstancesig

c# - 直接从 Razor View 调用 Controller 操作方法

我环顾四周,找不到简单的解决方案。我已经尝试过@GetUserName,但它不起作用。我已经尝试过@{GetUserName,但它不起作用。必须有一种从RazorView引擎调用方法的简单方法。它在foreach循环中。我需要GetUserName(item.userID)下面的代码在我的Controller中:[ChildActionOnly]publicstringGetUserName(intuserID){ProPit_Useruser=db.ProPit_User.Find(userID);returnuser.username;} 最佳答案