c#书写中遇到的一些错误和注意点

还是一些错误,只是这些错误可能比较小众,或者一般情况下不会出现,出现也是因为缺少某一样东西之类的。

1、写API时加载不出来IHttpActionResult

打开工具——库程序包管理器——程序包管理器控制台
输入:Install-Package Microsoft.AspNet.WebApi
下载包就可以了。

2、未能正确加载版本

这里写图片描述

这里写图片描述

未能正确加载6.0或者未能正确加载他的依赖项,可能是某一个配置文件强制让他使用规定版本。而引起的版本不对问题,这个时候可以让他强制使用你的当前版本。

在web.config中添加

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="4.5.0.0"/>
      </dependentAssembly>
</assemblyBinding>

3、行内编辑默认值

在初次加载中写

  onBeforeEdit: function (index, row)//在用户开始编辑一行的时候触发,参数包括:
                {
                    var ed = $('#custromList').datagrid('getEditor', { index: 1, field: 'sex' })
 if (row.sex) {
       $(ed.target).datebox('setVaiue', row.sex);
         }
 else{
        $(ed.target).datebox('setVaiue', 0);
      }
 },

posted on 2017-08-03 17:19  Grant-fu  阅读(96)  评论(0编辑  收藏  举报

导航