小编Gar*_*rry的帖子

Asp.net mvc dataannotation MaxLength验证不起作用

我在我的模型中使用asp.net mvc4我使用Maxlength属性但它不适用于字符串.只有Stringlength工作任何人都有同样的问题?如果有问题如何解决?它不适用于验证我的字段这是我的代码

(不工作)

[Required]
[MaxLength(80)]
[DisplayName("Contact Name:")]
public string ContactName { get; set; }
Run Code Online (Sandbox Code Playgroud)

(工作)

[Required]
[StringLength(80)]
[DisplayName("Contact Name:")]
public string ContactName { get; set; }
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc-4

19
推荐指数
2
解决办法
5万
查看次数

ObjectListItem"按"事件未被触发

不管这个

<List id="list" items="{/Report}">
      <items> 
          <ObjectListItem   press="onSelect"  title="{TYPE}"> </ObjectListItem>
      </items>
</List>
Run Code Online (Sandbox Code Playgroud)

也不是这个

<List id="list" items="{/Report}" itemPress="onSelect">
       <items> 
           <ObjectListItem   title="{TYPE}"> </ObjectListItem>
       </items>
</List>
Run Code Online (Sandbox Code Playgroud)

火灾

onSelect : function (oEvent) {
    'use strict';
    console.log("onSelect");
}
Run Code Online (Sandbox Code Playgroud)

在控制器中.

可能是什么原因导致的 控制台中没有相关的错误消息.

javascript model-view-controller sapui5

4
推荐指数
1
解决办法
958
查看次数

Web.MVC中的简单注射器,注射未发生

我是第一次使用Simple Injector.Nuget MVC QuickStart版本.在SimpleInjectorInializer.cs中,这被调用.

public static class SimpleInjectorInitializer
{
 /// <summary>Initialize the container and register it as MVC3 Dependency Resolver.</summary>
   public static void Initialize()
   {
      // Did you know the container can diagnose your configuration? 
     // Go to: https://simpleinjector.org/diagnostics
     var container = new Container();

     InitializeContainer(container);    
                container.RegisterMvcControllers(Assembly.GetExecutingAssembly());

            container.Verify();

      DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
  }

  private static void InitializeContainer(Container container)
  {                 
   // For instance:
   container.Register<IQueryProcessor, QueryProcessor>(Lifestyle.Singleton);
   container.RegisterInitializer<WebApiController>(
                p=> p.QueryProcessor = container.GetInstance<IQueryProcessor>());
   }

WebApiController.cs. Injection doesn't happen. 

public class WebApiController : ApiController
{

 public IQueryProcessor QueryProcessor …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc simple-injector

3
推荐指数
1
解决办法
1211
查看次数

在jquery中选择第一个div

我们如何使用jquery选择第一个div页面?

html jquery selection

2
推荐指数
1
解决办法
8989
查看次数

Asp.net MVC maxlength无法使用数据注释

我正在使用asp.net mvc 4我在我的模型中使用[maxlength(2)]但是它不能用于客户端验证我是asp.net mvc的新手.这是我的代码.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace RestrauntsMVC.Models
{
  public class Restraunts
  {

    public int id { get; set; }
    [Required]
    public string name { get; set; }
    [Required]
    [MaxLength(2),MinLength(1)]
    public int rating { get; set; }
    [Required]
    public string location { get; set; }
  }
}
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc-3

2
推荐指数
1
解决办法
6519
查看次数

如果被监视的目录在启动时不为空,C#可以触发FileSystemWatcher吗?

基本上,我有这个程序检查目录中的更改,如果有任何内容被复制或创建到所述目录中,则会发生一些事情.这很好用.但是,如果在程序启动时监视目录不为空,我希望代码能够触发,这可能吗?如果是这样,怎么样?

c# directory filesystemwatcher

1
推荐指数
1
解决办法
512
查看次数

创建具有多个单词的模型名称的约定是什么?

rails generate model FooTable  name:string

rails generate model foo_table name:string
Run Code Online (Sandbox Code Playgroud)

哪一个是正确的方法?

model ruby-on-rails

0
推荐指数
1
解决办法
43
查看次数