小编Jus*_*ing的帖子

Linq集团通过查询

试图找出一个linq查询,并想知道你们是否可以提供帮助.

我有一个对象列表,foo每个foo对象都有一个列表bar.bar具有活动日期和数值.例如

foo
   bar -> 01/02/05, 10000
   bar -> 04/06/10, 30023
foo
   bar -> 30/01/02, 23494
Run Code Online (Sandbox Code Playgroud)

我想写一个linq查询,它将返回一个明确的日期列表和该日期的总计

这可能是周五,但我画的是一片空白.

提前致谢

c# linq

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

有没有办法在WebForms中呈现部分视图?

我正在接触一个旧的,WebForms project但我早已离开了,现在我已经习惯了MVC.我正试图折射这个项目并提出一个让我疯狂的简单问题......

.aspx文件包含在另一个文件中的最佳方法是什么?

我不想为此直接拥有很多主文件,我所追求的只是一种类似的@Html.RenderPartial("MyFileName")东西

在一些现有文件中包含文件很难吗?

webforms asp.net-3.5

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

Json Stringify date与JavaScript date相比产生错误的日​​期

当我创建一个javascript日期,然后将stringify其发送到服务器时,我得到两个不同的日期。该stringified日期是始终慢一天。

所以目前我将javascript日期增加1天,以便我在服务器上收到相同的日期。

我当前的代码:

var dt = $(.datepicker).datepicker('getDate');//Fri Aug 26 2016 00:00:00 GMT+0200 (South Africa Standard Time)
var result = Json.stringify(dt); //"2016-08-25T22:00:00.000Z"
Run Code Online (Sandbox Code Playgroud)

这是正确的方法还是我缺少什么?

javascript json stringify

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

jquery scannerDetection ignoreIfFocusOn:'input'无法正常工作

scannerDetection.js用来扫描条形码:

    jQuery(document).ready(function () {
        $(document).scannerDetection({ ignoreIfFocusOn: 'input[type="text"]' });
    });
Run Code Online (Sandbox Code Playgroud)

但是上面的设置不起作用,因为每次我关注input元素时条形码都会显示在输入框中,而且form submit事件也会被触发.

我尝试使用:$(document).scannerDetection({ preventDefault:true }); 哪个有效,但不幸的是它也会阻止我的键盘输入.

我尝试使用不同版本的jquery库但没有成功.

根据这篇文章,插件及其设置应该可以正常工作.

我试着查看插件的源代码,但无法弄清楚:

(function ($) {
    $.fn.scannerDetection = function (options) {

        // If string given, call onComplete callback
        if (typeof options === "string") {
            this.each(function () {
                this.scannerDetectionTest(options);
            });
            return this;
        }

        // If false (boolean) given, deinitialize plugin
        if (options === false) {
            this.each(function () {
                this.scannerDetectionOff();
            });
            return this;
        }

        var defaults …
Run Code Online (Sandbox Code Playgroud)

javascript jquery barcode-scanner

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

jquery - 遍历树并查找具有指定类的元素

我认为这个closest()函数会为我做这个,但看起来不是.我有以下标记,我想class用类触发器添加到所有父锚点:

    <ul>
    <li class="selected">
      <a class="trigger" href=""></a> 
      <a href=""></a>
      <ul>
        <li class="selected">
          <a class="trigger" href=""></a> 
          <a href="" id = "my_target"></a>
        </li>
      </ul>
    </li>
  </ul>
Run Code Online (Sandbox Code Playgroud)

我要选择我的目标-在这个例子中,最深的锚,然后添加class到每个a.trigger在它的祖先.最好的方法是什么?谢谢.

javascript jquery

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

进度条不是一个函数

在带有引导进度条的页面上,我收到错误:

$(...).progressbar 不是函数

正如我所见,此错误似乎使我的其余脚本崩溃:

  1. Typeahead 无法在同一页面上工作我收到以下错误:

寻血猎犬未定义

  1. Bootstrap-select 不起作用
  2. 网页模板不起作用

enable.optimization有趣的是,如果我的设置为 ,我的其余脚本不会崩溃false

下面是我的进度条HTMLjavascript

function UpdateProgress(totalRecords, recordsProcessed, message) {

   var pct = recordsProcessed / totalRecords * 100;
   $('.progress-bar').css('width', pct + '%').attr('aria-valuenow', pct);

   $('#message').text(message);

   var msg = Math.round(pct, 2) + '% Complete';
   $('.progText').text(msg);

   if (pct > 0) {
     $('#progressRow').show();
   }

   if (pct == 100) {
     $('#progressRow').hide();
   }
 }


<div id="progressRow" class="row" >
  <div class="form-group">
    <div class="col-md-offset-2 col-sm-offset-2 col-md-10 col-sm-10 col-xs-12">
      <label id="message"></label>
      <div class="progress" style="height: 30px"> …
Run Code Online (Sandbox Code Playgroud)

asp.net optimization twitter-bootstrap

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

Bootstrap 文本对齐顶部中心

是否可以对齐文本topcenter(例如)使用引导程序。

我试过使用:

<label class=text-align-top text-align-center></label>
Run Code Online (Sandbox Code Playgroud)

它似乎不起作用。

css twitter-bootstrap-3

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

Angular - 错误 TS2307:找不到模块“ngx-bootstrap/modal”

我已经ngx-bootstrap使用该命令进行了安装,npm install ngx-bootstrap --save但是当我尝试构建解决方案时,它仍然说

ERROR in src/app/app.module.ts(37,45): error TS2307: Cannot find module 'ngx-bootstrap/modal'.

我已经检查了 node_modules 文件夹ngx-bootstrap/modal是否存在。

这是我的包裹

 {
  "name": "test-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.1.0",
    "@angular/common": "^5.1.0",
    "@angular/compiler": "^5.1.0",
    "@angular/core": "^5.1.0",
    "@angular/forms": "^5.1.0",
    "@angular/http": "^5.1.0",
    "@angular/platform-browser": "^5.1.0",
    "@angular/platform-browser-dynamic": "^5.1.0",
    "@angular/router": "^5.1.0",
    "@ng-select/ng-select": "^1.6.3",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^2.0.1",
    "angular2-jwt": …
Run Code Online (Sandbox Code Playgroud)

ngx-bootstrap ngx-bootstrap-modal

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

检查T是否实现了接口并在填充接口属性后返回T.

我有一个通用方法,它将T列表作为参数.我试图根据接口类型获取某些数据,并仅填充列表中每个项目的属性,这些属性在接口中定义.

所以我的基本界面是:

public interface IStatusResult
{
    int Status { get; set; }
    string StatusName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我有许多实现此接口的其他接口,我想用它来确定要检索的状态/状态名称键/值对:

public interface IROQStatusResult: IStatusResult { }
public interface IOrderStatusResult: IStatusResult { }
public interface IActivityStatusResult: IStatusResult { }
Run Code Online (Sandbox Code Playgroud)

最后,我在搜索结果类中实现了这个接口:

public class RecommendedOrderQuantitySearchResult:IROQStatusResult {
    public int Id { get; set; }
    public DateTime TargetDate { get; set; }
    public int Status { get; set; }
    public string StatusName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

所以一旦从Db获取List我想在Generic方法中设置状态名称:

    public static List<T> PopulateStatusNames<T>(List<T> items) where T:class …
Run Code Online (Sandbox Code Playgroud)

c# generics

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

bootrap选项卡中的ASP MVC jquery验证会导致意外的回发

我有一张表格里面有3张bootstrap tabs.Client Validationvalidation error发生的选项卡打开并submit button单击时,它可以正常工作.但是,当我切换到一个没有错误的选项卡(在其他选项卡中有错误)post back时,会出现a ,我得到正确的验证消息.

这是一个小问题,但在这种情况下不希望回发,因为必须在向服务器发送请求之前完成完整的客户端验证.

我该如何纠正这种行为?

下面是我的表单HTML的副本:

@model RBZPOSMVC.ViewModel.CreateEditItem
....
@using (Html.BeginForm()) 
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })

        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#Details">Item Details</a></li>
            <li><a data-toggle="tab" href="#Sales">Sale Price Groups</a></li>
            <li><a data-toggle="tab" href="#Purchases">Purchase Price Groups</a></li>
        </ul>

        <div class="tab-content">
            <div id="Details" class="tab-pane fade in active">
                <div class="form-group">
                    @Html.LabelFor(model => model.Item.ItemCode, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery-validation-engine twitter-bootstrap-3

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