小编And*_*rus的帖子

如果在jqgrid中单击其他行,如何结束内联编辑以格式化程序编辑操作按钮开始

使用编辑格式化程序操作按钮启动内联编辑.如果在其他行中单击,则旧行保持内联编辑模式.

如果单击其他行,如何结束旧行indline编辑.

http://www.trirand.com/blog/?page_id=393/bugs/wrong-hovering-effect-in-actions-formatter-of-jqgrid-4-1-0

看起来这行在4.1.2中得到了解决,但实际上问题仍然存在.

更新

如果使用自定义元素,则使用Oleg解决方法异常.发生异常的行在下面的代码中的注释中标记

// this is jqgrid custom_element property value:
function combobox_element(value, options, width, colName, entity, andmetp) {
    var elemStr;
    if (options.id === options.name)
    // form 
        elemStr = '<div>' +
           '<input class="FormElement ui-widget-content ui-corner-all" style="vertical-align:top" size="' +
                options.size + '"';
    else
        elemStr = '<div>' +
           '<input class="FormElement ui-widget-content " style="height:17px;vertical-align:top;width:' +
                width + 'px" '; 

    elemStr += ' value="' + value + '"' + ' id="' + options.id + '"/>';
    elemStr += '<button style="height:21px;width:21px;" tabindex="-1" /></div>'; …
Run Code Online (Sandbox Code Playgroud)

jqgrid

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

如何通过拖动列标题重新排序jqgrid中的列

这里的 jqgrid doc 包含:

方法允许使用鼠标重新排序网格列.在这种情况下唯一必要的设置是将jqGrid中的sortable选项设置为true.

我有sortable:true但是列不能通过鼠标拖动标题来重新排序.如何通过拖动列标题或其他方式重新排序列而不使用列选择器?

jqgrid

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

如何强制在窗体中输入活动的下一个输入字段

  • 移动Web应用程序包含订单输入表单.
  • 行包含产品代码和数量.
  • 移动条形码扫描器在条形码后发送输入,这导致表单提交.

如何在输入时阻止表单提交:输入应该像tab一样,它必须:

  • 激活下一个输入字段.
  • 提交应仅使用提交按钮完成.

使用jQuery,jQuery-mobile,ASP.NET MVC4.应用程序使用其基于WebKit的浏览器在Motorola MC2180计算机上运行.这是现代浏览器并支持html5.

数据输入页面:

    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width" />
      <link href="/Scripts/jquery-mobile/jquery.mobile-1.3.2.css" rel="stylesheet"/>
      <script src="/Scripts/jquery/jquery-1.9.1.js"></script>
      <script src="/Scripts/jquery-mobile/jquery.mobile-1.3.2.js"></script>
      <script src="/Scripts/applibrary.js"></script>

    </head>
    <body>
  <div>  
    <form id='inputform' method="post" 
       action ="/Detail/SaveFullDocument">
      <input type="hidden" name="_rows" />
      <table id="tableId">
        <tr>
          <th>Code</th>
          <th>Quantity</th>
          <td>
            <input type="button" value="+" onclick="addRow('tableId')" /></td>
        </tr>

        <tr>
          <td>
            <input type="text" name="Product" /></td>
          <td>
            <input type="number" name="Quantity" /></td>
          <td>
            <input type="button" value="-" onclick="deleteRow(this)" /></td>
        </tr>
        <tr>
          <td>
            <input type="text" name="Product" /></td>
          <td>
            <input …
Run Code Online (Sandbox Code Playgroud)

html javascript asp.net-mvc jquery jquery-mobile

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

如何将yYYYMMDDHHMMSS转换为2013-11-24 11:29:07在postgres中

Postgres char(14)字段存储datetime withou分隔符,如20131124112907

如何添加分隔符,以便结果是格式化的字符串

2013-11-24 11:29:07

我试过让丹尼斯回答

to_timestamp(timestamp, 'YYYYMMDDHHMISS')::text as updated_at
Run Code Online (Sandbox Code Playgroud)

但是有例外

  Message=ERROR: 22007: hour "15" is invalid for the 12-hour clock
  Code=22007

  File=src\backend\utils\adt\formatting.c
  Hint=Use the 24-hour clock, or give an hour between 1 and 12.
Run Code Online (Sandbox Code Playgroud)

sql postgresql

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

“使用范围运算符”建议修复产生无效代码

来自 .NET 4 的 ASP.NET 5 MVC 项目使用 Substring 是源代码,如

id = row.Categoryid?.Substring(0, 1) == "$" ? row.Categoryid?.Substring(startIndex: 1) :
                                               row.Categoryid?.Substring(0)
Run Code Online (Sandbox Code Playgroud)

Visual Studio 2019 质量检查员抛出消息

IDE0057 子串可以简化

开始索引:1

应用建议的修复后

使用范围运算符

代码重构为

id = row.Categoryid?.Substring(0, 1) == "$" ? row.Categoryid?.Substring[1..] :
                                               row.Categoryid?.Substring(0)
Run Code Online (Sandbox Code Playgroud)

抛出编译错误

错误 CS0021 无法将带有 [] 的索引应用于“方法组”类型的表达式

如何解决这个问题,以便重构创建正确的代码?

c# visual-studio asp.net-core-mvc roslyn-code-analysis asp.net-core

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

从信息日志级别删除内存缓存消息响应

ASP.NET Core 5 MVC 应用程序在 Debian Linux 中使用 Weboptimizer ( https://github.com/ligershark/WebOptimizer )。

在startUp.cs中我有:

    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddWebOptimizer();
        ...
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    { 
        ...
        app.UseWebOptimizer();
        ...
    }
Run Code Online (Sandbox Code Playgroud)

syslog 包含大量信息消息,例如

4 月 18 日 09:12:26 c202-76 kestrel-store[28711]:#033[40m#033[32minfo#033[39m#033[22m#033[49m: WebOptimizer.AssetMiddleware][1000]

4 月 18 日 09:12:26 c202-76 kestrel-store[28711]:请求已开始 '/css/siteerp.css' 4 月 18 日 09:12:26 c202-76 kestrel-store[28711]:#033[40m# 033[32minfo#033[39m#033[22m#033[49m: WebOptimizer.AssetBuilder][1001]

4 月 18 日 09:12:26 c202-76 kestrel-store[28711]:从内存缓存响应“/css/siteerp.css”

4 月 18 日 09:12:26 c202-76 kestrel-store[28711]:#033[40m#033[32minfo#033[39m#033[22m#033[49m: WebOptimizer.AssetMiddleware][1000]

4 月 18 日 09:12:26 …

asp.net-core-mvc .net-core kestrel-http-server asp.net-core weboptimizer

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

如何在jqGrid中将额外参数传递给Add和Edit url

订单ID存储在变量_documentId中,并在运行时通过ajax调用更改,如果新订单保存为实际订单.

如果向jqGrid添加新的详细信息行添加表单网址或内联编辑网址也需要此ID.我尝试使用postdata但是如果调用Edit和Add url则不传递_documentId.如何将_documentId值传递给那些网址?

   var _documentId; // assigned from ajax call after save.

   $(function () {
        var grid = $("#grid");
        grid.jqGrid({
            postData: {_documentId: function() { return _documentId } },
            editurl: 'Edit',  // How to pass _documentId value to this controller ?

            url: 'GetData',
            datatype: "json",
            mtype: 'POST',
            scroll: 1,
            multiselect: true,
            multiboxonly: true, 
            scrollingRows : true,
            autoencode: true,
            prmNames:  {id:"_rowid", oper: "_oper" }, 
            colModel: <%= Model.ColModel() %>,
            gridview: true,
            toppager: true,
            viewrecords: true
            });

      grid.navGrid("#grid_toppager", {}, {}
        { url: 'Add' } …
Run Code Online (Sandbox Code Playgroud)

jqgrid

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

如何在ASP.NET MVC4中捕获Web API中的表单授权错误

ASP.NET/Mono MVC4 Web API v.1应用程序.

API控制器使用表单授权,并使用标准[Authorize]属性进行修饰.如果授权失败,则标准api错误消息

<Error>
<Message>Authorization has been denied for this request.</Message>
</Error>
Run Code Online (Sandbox Code Playgroud)

发生.如何通过写入日志文件来识别此错误.返回给调用者shoudl的错误消息保持不变.如何添加额外的代码,这可以写入此错误消息与整个http请求标头和正文到日志文件?

我从问题中添加了代码

如何为C#MVC4 WebAPI应用程序全局记录所有异常?

如何在ASP.NET MVC4 Web API中捕获未定义的api方法调用

但是没有抓住错误的错误.

如何捕捉所有错误?

更新

代码需要在Windows 2003服务器中运行.我从回答中尝试了代码,但遇到了编译错误

Predefined type 'System.Runtime.CompilerServices.IAsyncStateMachine' is not defined or imported

Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?

Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-4 asp.net-web-api

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

如何在ASP.NET MVC控制器参数中将毫秒转换为DateTime

Gant图表以毫秒为单位将时间传递给MVC4控制器.下面的代码打印出1440190800000

$(".gantt").gantt({
    onAddClick: function (dt, rowId) {
        alert(dt);
        window.location.href='NewBooking?' + $.param({
            datetime: dt,
            row: rowId
        });
    },
Run Code Online (Sandbox Code Playgroud)

MVC4控制器有签名:

public ActionResult NewBooking(DateTime datetime, string row)
{
    var m = new NewBookingViewModel();
    return View(m);
}
Run Code Online (Sandbox Code Playgroud)

调用此控制器会导致错误

The parameters dictionary contains a null entry for parameter 'datetime' of non-nullable type 'System.DateTime' for method 'System.Web.Mvc.ActionResult NewBooking(System.DateTime, System.String)' in 'Eeva.Erp.Controllers.BookingController'. An optional parameter must be a 
since milliseconds are not contverted to datetime.
Run Code Online (Sandbox Code Playgroud)

如何在控制器代码或javascript中修复此问题以获取DateTime值?

c# asp.net asp.net-mvc datetime asp.net-mvc-4

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

如何在 Json.Net 的派生类中仅序列化非空属性

实体对象需要转换为字符串以将它们存储在日志文件中以供人类阅读。属性可以在运行时添加到派生实体。序列化在实体基类中定义。我尝试了下面的代码,但它也返回具有空值的属性。由于许多属性具有空值,这使得日志难以阅读。

Hoq 仅序列化非空属性?我也试过

        var jsonSettings = new JsonSerializerSettings()
        {
            DefaultValueHandling = DefaultValueHandling.Ignore,
            Formatting = Formatting.Indented,
            TypeNameHandling= TypeNameHandling.All
        };
        return JsonConvert.SerializeObject(this, GetType(), jsonSettings);
Run Code Online (Sandbox Code Playgroud)

这仅序列化newtonsoft json 中确认的 EntityBase 类属性不会序列化派生类属性

public class EntityBase {

        public string Serialize()
        {
            var s = new System.Web.Script.Serialization.JavaScriptSerializer();
            s.Serialize(this);

        }
     }

public class Customer: EntityBase {
  public string Name, Address;
  }
Run Code Online (Sandbox Code Playgroud)

测试用例:

  var cust= new Customer() { Name="Test"};
  Debug.Writeline( cust.Serialize());
Run Code Online (Sandbox Code Playgroud)

观察到:结果包含“地址”:空

预期:结果不应包含地址属性。

使用 ASP.NET/Mono MVC4、.NET 4.6

c# asp.net-mvc serialization json json.net

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

如何在 FromSqlRaw 查询中转义 { 字符

在使用 Npsql EF Core 数据提供程序的 EF Core 中,查询如

await ctx.Doc.FromSqlRaw(@"select * from Doc where id=any('{1,2,3}')");
Run Code Online (Sandbox Code Playgroud)

抛出错误

索引(从零开始)必须大于或等于零且小于参数列表的大小。

如何在查询中使用{}字符以使它们不被视为参数?

npgsql entity-framework-core .net-core asp.net-core

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