Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 数据:函数(参数){ 变量查询={ 匹配:params.term, 页码:params.page | | 1, pageSize:params.pageSize | 5 } 返回查询; }, processResults:函数(数据、参数){ 控制台日志(params); 返回{ 结果:数据项, 页码:params.page, 分页:{ 更多:(params.page*5)m.text.Contains(match)).ToList(); } 结果列表结果=新结果列表 { 项目=模型, 总计数=5, }; 返回Json(结果,JsonRequestBehavior.AllowGet); } @using (Html.BeginForm("RegisterModify", "Account", FormMethod.Post, new { @class = "form-horizontal"})) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) <div class="well blanc" > <div class="form-group"> @Html.LabelFor(model => model.SelectedMatric, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownListFor(model => model.SelectedMatric, Model.DisplayedNames, "--Selectionnez--", new { @class = "form-control" }) @*@Html.HiddenFor(model => model.SelectedMatric, new { id="SelectedMatric"})*@ @Html.ValidationMessageFor(model => model.SelectedMatric, "", new { @class = "text-danger" }) </div> </div> @*the rest of view *@ <p> <input type="submit" value="Créer" class="btn btn-primary" /> </p> $('#SelectedMatric').select2({ placeholder: "--Selectionnez--", width: '100%', minimumInputLength: 0, allowClear: true, ajax: { url: '@Url.Action("GetUsersFiltredPaged")', dataType: 'json', type: 'Get', data: function (term, page) { return { match: term, page: page, pageSize: 5 }; }, results: function (result, page) { var more = (page * 5) < result.totalCount; return { results: result.items, page: page, more: more }; } } }); public class ModelDto { public string id { get; set; } public string text { get; set; } } public class ResultList<T> { public List<T> items { get; set; } public int total_count { get; set; } } ipt> $(function () { $('#SelectedMatric').select2({ placeholder: "--Selectionnez--", width: '50%', minimumInputLength: 0, allowClear: true, ajax: { url: '@Url.Action("GetUsersFiltredPaged")', dataType: 'json', type: 'Get', data: function (params) { var query = { match: params.term, page: params.page || 1, pageSize: params.pageSize || 5 } return query; }, processResults: function (data, params) { console.log(params); return { results: data.items, page:params.page, pagination: { more:(params.page * 5) < data.total_count } } }, }, }); }) </script> public JsonResult GetUsersFiltredPaged(string match, int page = 1, int pageSize = 5) { List<ModelDto> model = new List<ModelDto> { new ModelDto{id = "1", text = "Option1" }, new ModelDto{id = "2", text = "Option2" }, new ModelDto{id = "3", text = "Option3" }, new ModelDto{id = "4", text = "Option4" }, new ModelDto{id = "5", text = "Option5" }, }; if (!string.IsNullOrWhiteSpace(match)) { model = model.Where(m => m.text.Contains(match)).ToList(); } ResultList<ModelDto> results = new ResultList<ModelDto> { items = model, total_count = 5, }; return Json(results, JsonRequestBehavior.AllowGet); }_C#_Asp.net Mvc_Jquery Select2 - Fatal编程技术网

C# 数据:函数(参数){ 变量查询={ 匹配:params.term, 页码:params.page | | 1, pageSize:params.pageSize | 5 } 返回查询; }, processResults:函数(数据、参数){ 控制台日志(params); 返回{ 结果:数据项, 页码:params.page, 分页:{ 更多:(params.page*5)m.text.Contains(match)).ToList(); } 结果列表结果=新结果列表 { 项目=模型, 总计数=5, }; 返回Json(结果,JsonRequestBehavior.AllowGet); } @using (Html.BeginForm("RegisterModify", "Account", FormMethod.Post, new { @class = "form-horizontal"})) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) <div class="well blanc" > <div class="form-group"> @Html.LabelFor(model => model.SelectedMatric, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownListFor(model => model.SelectedMatric, Model.DisplayedNames, "--Selectionnez--", new { @class = "form-control" }) @*@Html.HiddenFor(model => model.SelectedMatric, new { id="SelectedMatric"})*@ @Html.ValidationMessageFor(model => model.SelectedMatric, "", new { @class = "text-danger" }) </div> </div> @*the rest of view *@ <p> <input type="submit" value="Créer" class="btn btn-primary" /> </p> $('#SelectedMatric').select2({ placeholder: "--Selectionnez--", width: '100%', minimumInputLength: 0, allowClear: true, ajax: { url: '@Url.Action("GetUsersFiltredPaged")', dataType: 'json', type: 'Get', data: function (term, page) { return { match: term, page: page, pageSize: 5 }; }, results: function (result, page) { var more = (page * 5) < result.totalCount; return { results: result.items, page: page, more: more }; } } }); public class ModelDto { public string id { get; set; } public string text { get; set; } } public class ResultList<T> { public List<T> items { get; set; } public int total_count { get; set; } } ipt> $(function () { $('#SelectedMatric').select2({ placeholder: "--Selectionnez--", width: '50%', minimumInputLength: 0, allowClear: true, ajax: { url: '@Url.Action("GetUsersFiltredPaged")', dataType: 'json', type: 'Get', data: function (params) { var query = { match: params.term, page: params.page || 1, pageSize: params.pageSize || 5 } return query; }, processResults: function (data, params) { console.log(params); return { results: data.items, page:params.page, pagination: { more:(params.page * 5) < data.total_count } } }, }, }); }) </script> public JsonResult GetUsersFiltredPaged(string match, int page = 1, int pageSize = 5) { List<ModelDto> model = new List<ModelDto> { new ModelDto{id = "1", text = "Option1" }, new ModelDto{id = "2", text = "Option2" }, new ModelDto{id = "3", text = "Option3" }, new ModelDto{id = "4", text = "Option4" }, new ModelDto{id = "5", text = "Option5" }, }; if (!string.IsNullOrWhiteSpace(match)) { model = model.Where(m => m.text.Contains(match)).ToList(); } ResultList<ModelDto> results = new ResultList<ModelDto> { items = model, total_count = 5, }; return Json(results, JsonRequestBehavior.AllowGet); }

C# 数据:函数(参数){ 变量查询={ 匹配:params.term, 页码:params.page | | 1, pageSize:params.pageSize | 5 } 返回查询; }, processResults:函数(数据、参数){ 控制台日志(params); 返回{ 结果:数据项, 页码:params.page, 分页:{ 更多:(params.page*5)m.text.Contains(match)).ToList(); } 结果列表结果=新结果列表 { 项目=模型, 总计数=5, }; 返回Json(结果,JsonRequestBehavior.AllowGet); } @using (Html.BeginForm("RegisterModify", "Account", FormMethod.Post, new { @class = "form-horizontal"})) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) <div class="well blanc" > <div class="form-group"> @Html.LabelFor(model => model.SelectedMatric, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownListFor(model => model.SelectedMatric, Model.DisplayedNames, "--Selectionnez--", new { @class = "form-control" }) @*@Html.HiddenFor(model => model.SelectedMatric, new { id="SelectedMatric"})*@ @Html.ValidationMessageFor(model => model.SelectedMatric, "", new { @class = "text-danger" }) </div> </div> @*the rest of view *@ <p> <input type="submit" value="Créer" class="btn btn-primary" /> </p> $('#SelectedMatric').select2({ placeholder: "--Selectionnez--", width: '100%', minimumInputLength: 0, allowClear: true, ajax: { url: '@Url.Action("GetUsersFiltredPaged")', dataType: 'json', type: 'Get', data: function (term, page) { return { match: term, page: page, pageSize: 5 }; }, results: function (result, page) { var more = (page * 5) < result.totalCount; return { results: result.items, page: page, more: more }; } } }); public class ModelDto { public string id { get; set; } public string text { get; set; } } public class ResultList<T> { public List<T> items { get; set; } public int total_count { get; set; } } ipt> $(function () { $('#SelectedMatric').select2({ placeholder: "--Selectionnez--", width: '50%', minimumInputLength: 0, allowClear: true, ajax: { url: '@Url.Action("GetUsersFiltredPaged")', dataType: 'json', type: 'Get', data: function (params) { var query = { match: params.term, page: params.page || 1, pageSize: params.pageSize || 5 } return query; }, processResults: function (data, params) { console.log(params); return { results: data.items, page:params.page, pagination: { more:(params.page * 5) < data.total_count } } }, }, }); }) </script> public JsonResult GetUsersFiltredPaged(string match, int page = 1, int pageSize = 5) { List<ModelDto> model = new List<ModelDto> { new ModelDto{id = "1", text = "Option1" }, new ModelDto{id = "2", text = "Option2" }, new ModelDto{id = "3", text = "Option3" }, new ModelDto{id = "4", text = "Option4" }, new ModelDto{id = "5", text = "Option5" }, }; if (!string.IsNullOrWhiteSpace(match)) { model = model.Where(m => m.text.Contains(match)).ToList(); } ResultList<ModelDto> results = new ResultList<ModelDto> { items = model, total_count = 5, }; return Json(results, JsonRequestBehavior.AllowGet); },c#,asp.net-mvc,jquery-select2,C#,Asp.net Mvc,Jquery Select2,控制器: public JsonResult GetUsersFiltredPaged(string match, int page = 1, int pageSize = 5) { List<ModelDto> model = new List<ModelDto> { new ModelDto{id = "1", text = "Option1" }, new ModelDto{i

控制器:

public JsonResult GetUsersFiltredPaged(string match, int page = 1, int pageSize = 5)
    {
        List<ModelDto> model = new List<ModelDto>
        {
            new ModelDto{id = "1", text  = "Option1" },
            new ModelDto{id = "2", text  = "Option2" },
            new ModelDto{id = "3", text  = "Option3" },
            new ModelDto{id = "4", text  = "Option4" },
            new ModelDto{id = "5", text  = "Option5" },
        };

        if (!string.IsNullOrWhiteSpace(match))
        {
            model = model.Where(m => m.text.Contains(match)).ToList();
        }

        ResultList<ModelDto> results = new ResultList<ModelDto>
        {
            items = model,
            total_count = 5,
        };
        return Json(results, JsonRequestBehavior.AllowGet);
    }
public JsonResult GetUsersFiltredPaged(字符串匹配,int page=1,int pageSize=5)
{
列表模型=新列表
{
新模型dto{id=“1”,text=“Option1”},
新模型dto{id=“2”,text=“Option2”},
新模型dto{id=“3”,text=“Option3”},
新模型dto{id=“4”,text=“Option4”},
新型号DTO{id=“5”,text=“Option5”},
};
如果(!string.IsNullOrWhiteSpace(匹配))
{
model=model.Where(m=>m.text.Contains(match)).ToList();
}
结果列表结果=新结果列表
{
项目=模型,
总计数=5,
};
返回Json(结果,JsonRequestBehavior.AllowGet);
}
     @using (Html.BeginForm("RegisterModify", "Account", FormMethod.Post, new { @class = "form-horizontal"}))
     {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)

       <div class="well blanc" >

          <div class="form-group">
            @Html.LabelFor(model => model.SelectedMatric, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
            @Html.DropDownListFor(model => model.SelectedMatric, Model.DisplayedNames, "--Selectionnez--", new { @class = "form-control" })
            @*@Html.HiddenFor(model => model.SelectedMatric, new { id="SelectedMatric"})*@
            @Html.ValidationMessageFor(model => model.SelectedMatric, "", new { @class = "text-danger" })
        </div>
    </div>

  @*the rest of view *@
  <p>
        <input type="submit" value="Créer" class="btn btn-primary" />
  </p>
  $('#SelectedMatric').select2({
            placeholder: "--Selectionnez--",
            width: '100%',
            minimumInputLength: 0,
            allowClear: true,
            ajax: {
                url: '@Url.Action("GetUsersFiltredPaged")',
                dataType: 'json',
                type: 'Get',

                data: function (term, page) {
                    return { match: term, page: page, pageSize: 5 };
                },
                results: function (result, page) {
                    var more = (page * 5) < result.totalCount;
                    return { results: result.items, page: page, more: more };
                }
            }
        });
public class ModelDto
{
    public string id { get; set; }
    public string text { get; set; }
}

public class ResultList<T>
{
    public List<T> items { get; set; }
    public int total_count { get; set; }
}
ipt>

    $(function () {
        $('#SelectedMatric').select2({
            placeholder: "--Selectionnez--",
            width: '50%',
            minimumInputLength: 0,
            allowClear: true,
            ajax: {
                url: '@Url.Action("GetUsersFiltredPaged")',
                dataType: 'json',
                type: 'Get',

                data: function (params) {
                    var query = {
                        match: params.term,
                        page: params.page || 1,
                        pageSize: params.pageSize || 5
                    }
                    return query;
                },
                processResults: function (data, params) {
                    console.log(params);
                    return {
                        results: data.items,
                        page:params.page,
                        pagination: {
                            more:(params.page * 5) < data.total_count
                        }
                    }
                },
            },
        });
    })

</script>
public JsonResult GetUsersFiltredPaged(string match, int page = 1, int pageSize = 5)
    {
        List<ModelDto> model = new List<ModelDto>
        {
            new ModelDto{id = "1", text  = "Option1" },
            new ModelDto{id = "2", text  = "Option2" },
            new ModelDto{id = "3", text  = "Option3" },
            new ModelDto{id = "4", text  = "Option4" },
            new ModelDto{id = "5", text  = "Option5" },
        };

        if (!string.IsNullOrWhiteSpace(match))
        {
            model = model.Where(m => m.text.Contains(match)).ToList();
        }

        ResultList<ModelDto> results = new ResultList<ModelDto>
        {
            items = model,
            total_count = 5,
        };
        return Json(results, JsonRequestBehavior.AllowGet);
    }