小编Ehs*_*jad的帖子

JQuery DataTables插件:TypeError:e [j]未定义

我不明白为什么DataTables在FF中抛出此错误:TypeError:e [j]未定义

在IE中它被报告为:无法获取未定义或空引用的属性'aDataSort'

这是代码

HTML

<table id="fp_promotion_history">
<thead>
    <tr>
        <th>AuditID</th>
        <th>Action</th>
        <th>Description</th>
        <th>User Name</th>
        <th>Audit Date</th>
    </tr>
</thead>
<tbody>
    <tmpl_loop name='fp_history'>
        <tr id="AuditID_<tmpl_var name='AuditID'>">
            <td data-AuditID="<tmpl_var name='AuditID'>"><tmpl_var name='AuditID'></td>  
            <td data-Action="<tmpl_var name='Action'>"><tmpl_var name='Action'></td>
            <td data-Audit_Desc="<tmpl_var name='Audit_Desc'>"><tmpl_var name='Audit_Desc'></td>
            <td data-User_Name="<tmpl_var name='User_Name'>"><tmpl_var name='User_Name'></td>               
            <td data-Audit_Date="<tmpl_var name='Audit_Date'>"><tmpl_var name='Audit_Date'></td>
        </tr>
    </tmpl_loop>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

JQuery的

        showDialog({content:data,title:'Financial Promotion Audit Trail History (FPID : ' + $('#fp_promotions_table tr.selected').attr('id') + ')'});                                            

        // turn into a datatable
        $('#fp_promotion_history').dataTable({        
                "sDom": 'R<"H"fr>t<"F"ip>',            
                "bJQueryUI": true,
                "sPaginationType": "full_numbers",
                "iDisplayLength": 25,
                "order": [[ 5, "desc" …
Run Code Online (Sandbox Code Playgroud)

ajax jquery datatables jquery-datatables

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

实体框架:我可以包含()子类型的属性吗?

我在我的EF项目中设置了TPT继承,其中包含一个超类型和两个子类型.我希望获得超类型的所有对象和Include()子类型的导航属性,以达到此效果(更改类名以保护befuddled):

var thelist = DataContext.Fleets
    .Include(x => x.Vehicles.Select(y => y.EngineData)) // Not specific to Car or Truck
    .Include(x => x.Vehicles.OfType<Car>().Select(y => y.BultinEntertainmentSystemData)) // Only Cars have BultinEntertainmentSystemData
    .ToList();
Run Code Online (Sandbox Code Playgroud)

因此,我希望获得所有车辆,包括车辆是汽车时内置娱乐系统的信息.我已经看到,如果我直接从DbSet开始,这是可行的,但在这里我正在查看Fleet对象的集合属性.当我在集合属性上使用带有OfType()调用的Include()调用时,我会收到此异常消息:

Include路径表达式必须引用在类型上定义的导航属性.使用虚线路径作为参考导航属性,使用Select运算符作为集合导航属性.

是否可以在集合属性中包含()子类型的属性?

c# entity-framework

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

无法加载文件或程序集"System.Net.Http"或其依赖项之一

也许相关信息:我有一个我用.net 4.5构建的Web应用程序.我想部署到Azure的网站,但它只支持.net 4.0,所以我将项目降级为.net 4.0.它在本地运行时仍然有效.

当我发布到Azure时,我收到此错误:

无法加载文件或程序集"System.Net.Http"或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

我尝试用nuget删除Web API并读取它,正如SO建议的另一个问题,但我仍然有同样的问题.
我试过关闭/打开VS,并清理/构建.

.net c# azure

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

如何将视图中的列表传递给控制器​​?

我有一个视图,内部我正在生成一个列表,但我无法成功将其传递给控制器​​而没有字段为null:

我的观点代码:

@using (Html.BeginForm("AddFOP", "Revenue", null,  FormMethod.Post, new { enctype = "multipart/form-data" }))
           {
              <table class="grid" style="margin-top: 15px">
                    <thead>
                        <tr>
                            <th>FOP</th>
                            <th>ORGN</th>
                            <th>PROGRAM</th>
                            <th>PERCENTAGE</th>
                            <th></th>

                        </tr>
                    </thead>
                    <tbody>               
                        @for (int i = 0; i < Model.editBillingFOPList.Count;i++ )
                        { 

                         <tr>
                            <td>@Html.TextBox("FOPList[" + @i + "].Fund", 
                                                Model.editBillingFOPList[i].Fund)</td>
                            <td>@Html.TextBox("FOPList[" + @i + "].ORGN", 
                                                Model.editBillingFOPList[i].ORGN)</td>
                            <td>@Html.TextBox("FOPList[" + @i + "].Program", 
                                                Model.editBillingFOPList[i].Program)</td>
                            <td>@Html.TextBox("FOPList[" + @i + "].Percentage", 
                                                Model.editBillingFOPList[i].Percentage)</td>
                        </tr>
Run Code Online (Sandbox Code Playgroud)

这是控制器:

[HttpPost]
        public ActionResult AddFOP(List<BillingFOPModel> FOPList)
        {


            return View();
        }
Run Code Online (Sandbox Code Playgroud)

我的FOPList显示计数为1,如果我在调试模式下展开它,它会显示模型列表但是具有空值 - 任何想法?

我的型号:

 public class …
Run Code Online (Sandbox Code Playgroud)

c# model-view-controller asp.net-mvc

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

文件读取外来字符

我试图从.ini文件中读取外来字符.这是我正在使用的方法

[DllImport("kernel32")]
public static extern int GetPrivateProfileString(string Section, 
                                                 int Key,
                                                 string Value,
                                                 [MarshalAs(UnmanagedType.LPArray)] byte[] Result,
                                                 int Size, 
                                                 string FileName);

public static string[] GetEntryNames(string section, string iniPath)
    {
        for (int maxsize = 500; true; maxsize *= 2)
        {
            byte[] bytes = new byte[maxsize];
            int size = Imports.GetPrivateProfileString(section, 0, "", bytes, maxsize, iniPath);
            if (size < maxsize - 2)
            {
                string entries = Encoding.ASCII.GetString(bytes, 0,
                                          size - (size > 0 ? 1 : 0));
                Console.WriteLine("Entries: " + entries.Split(new char[] { '\0' })[3]); …
Run Code Online (Sandbox Code Playgroud)

c# encoding byte file char

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

为什么C#可以在运行时处理这个明显的愚蠢对象推广?

我非常喜欢C#语言.我只是玩游戏,绝不会在生产代码中使用下面的代码.显然,编译器被结构的布局所欺骗.但是为什么Super Class上的字符串仍然可以在运行时写入和读取?我本来期望一些内存访问违规.在运行时检查类型,它表示它是Base类型,请参阅NoProblem()函数执行.没有实例化超级类.

它怎么能这样运作?

using System;
using System.Runtime.InteropServices;

namespace Fiddle
{
    class Program
    {
        static void Main(string[] args)
        {
            var b = new Base
            {
                IntOnBase = 1
            };
            var overlay = new Overlay();
            overlay.Base = b;
            var super = overlay.Super;
            var intValue = super.IntOnBase;
            super.StringOnSuper = "my test string";
            var stringValue = super.StringOnSuper;
            super.NoProblem();
            Expressions.Fiddle();
        }
    }

    [StructLayout(LayoutKind.Explicit)]
    public struct Overlay
    {
        [FieldOffset(0)]
        public Super Super;
        [FieldOffset(0)]
        public Base Base;
    }

    public class Super : Base
    {
        public …
Run Code Online (Sandbox Code Playgroud)

c# inheritance struct structlayout

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

使用ViewBag的Asp.net mvc下拉列表

我在数据库表字段有:Id,Organisation,Info.

我想要像这样制作dropdowm列表:

<select>
  <option value='Id there'>'Organisation there'</option>...
Run Code Online (Sandbox Code Playgroud)

我试着用ViewBag做到这一点:

ViewBag.Organisations = db.Organisations.ToList(); // get all fields from table using dbContext
Run Code Online (Sandbox Code Playgroud)

在视图中:

@Html.DropDownList('I don`t know what i shoud write here, please help')
Run Code Online (Sandbox Code Playgroud)

我如何建立下拉列表?

c# asp.net asp.net-mvc drop-down-menu

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

CreateInstanceAndUnwrap无法加载程序集

我试图在我的控制台应用程序中的新AppDomain中加载程序集A,其中包含相同的基目录和RelativePath作为默认域.

当我使用CreateInstanceFrom从A创建一个类型时它成功但是当我使用CreateInstanceAndUnwrap它时无法找到汇编文件FileLoadException.请记住,程序A.MyTypeB.Typeb在其构造函数中调用程序集中的方法.两个程序集文件都出现在执行程序集的父文件夹中的相同路径中(..\Mytypes)

_domain = AppDomain.CreateDomain("MyDomain" + Guid.NewGuid(), null, AppDomain.CurrentDomain.SetupInformation);
var mytype = _domain.CreateInstanceAndUnwrap(pathtoassembly, typename);
Run Code Online (Sandbox Code Playgroud)

这是错误消息:

无法加载文件或程序集'..\Mytypes\A.dll'或其依赖项之一.给定的程序集名称或代码库无效.(来自HRESULT的异常:0x80131047)`

c# reflection appdomain

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

async等待在调用aync方法时返回Task <List <T >>而不是List <T>

我试图了解异步等待的用法,我研究了一些博客文章,现在我已经制作了一个测试代码,但它没有按照我期望的方式工作.

我有一个返回List的方法:

private List<Employee> GetEmployees()
{

 IList<Employee> list = new List<Employee>();
 list.Add(new Employee() { Id = 1, Age = 20, Name = "Kavin" });
 list.Add(new Employee() { Id = 2, Age = 30, Name = "Alen" });
 list.Add(new Employee() { Id = 3, Age = 20, Name = "Suresh" });
 list.Add(new Employee() { Id = 4, Age = 30, Name = "Jay" });
 list.Add(new Employee() { Id = 5, Age = 20, Name = "Nanda" });
 list.Add(new Employee() { Id …
Run Code Online (Sandbox Code Playgroud)

.net c# asynchronous task-parallel-library async-await

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

IL中"specialname"和"rtspecialname"的目的和意义

我现在特别想了解IL代码和C#内部,我写了一个简单的c#hello world程序,代码是:

using System;
class Program
{
    public static void Main()
    {
       Console.WriteLine("Hello World");
    }
}
Run Code Online (Sandbox Code Playgroud)

这里是为Program类的构造函数生成的IL :

.method public hidebysig specialname rtspecialname 
        instance void  .ctor() cil managed
{
  // Code size       7 (0x7)
  .maxstack  8
  IL_0000:  ldarg.0
  IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
  IL_0006:  ret
} // end of method Program::.ctor
Run Code Online (Sandbox Code Playgroud)

我无法理解是什么的意义和目的specialnamertspecialname或有什么用他们的?

c# il ildasm

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