Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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
Jquery 复选框更改事件在局部视图mvc中不起作用 我有一个部分视图页面,有3个单选按钮,即所有员工、指定和确认日期。默认情况下,选择第一个。单击第三个单选按钮后,我需要在文本框中输入日期,然后进行ajax调用,并在div标记中呈现按日期过滤的数据。 ///下面是该局部视图的代码 @模型HRMS.Models.EligibilityCriteriaModel @{ ViewBag.Title=“Index”; } @Html.HiddenFor(modeleItem=>modeleItem.allConfirmationDateEmployeeListCount,新的{id=“confirmationDateEmployeeCount”}) @if(Model.allConfirmationDateEmployeeList!=null) { 员工代码 员工姓名 交付团队 任命 确认日期 挑选 @foreach(Model.allConfirmationDateEmployeeList中的var项) { @DisplayFor(modelItem=>item.EmployeeCode,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.EmployeeName,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.DeliveryTeam,新的{@readonly=“readonly”}) @DisplayFor(modeleItem=>item.Designation,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.ConfirmationDate,新的{@readonly=“readonly”}) @Html.CheckBoxFor(modelItem=>item.Checked,新的{@class=“chkAllConfDateEmployees”,@id=item.EmployeeID,@for=item.evaluationyearid}) } }_Jquery_Asp.net Mvc_Asp.net Mvc Partialview - Fatal编程技术网

Jquery 复选框更改事件在局部视图mvc中不起作用 我有一个部分视图页面,有3个单选按钮,即所有员工、指定和确认日期。默认情况下,选择第一个。单击第三个单选按钮后,我需要在文本框中输入日期,然后进行ajax调用,并在div标记中呈现按日期过滤的数据。 ///下面是该局部视图的代码 @模型HRMS.Models.EligibilityCriteriaModel @{ ViewBag.Title=“Index”; } @Html.HiddenFor(modeleItem=>modeleItem.allConfirmationDateEmployeeListCount,新的{id=“confirmationDateEmployeeCount”}) @if(Model.allConfirmationDateEmployeeList!=null) { 员工代码 员工姓名 交付团队 任命 确认日期 挑选 @foreach(Model.allConfirmationDateEmployeeList中的var项) { @DisplayFor(modelItem=>item.EmployeeCode,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.EmployeeName,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.DeliveryTeam,新的{@readonly=“readonly”}) @DisplayFor(modeleItem=>item.Designation,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.ConfirmationDate,新的{@readonly=“readonly”}) @Html.CheckBoxFor(modelItem=>item.Checked,新的{@class=“chkAllConfDateEmployees”,@id=item.EmployeeID,@for=item.evaluationyearid}) } }

Jquery 复选框更改事件在局部视图mvc中不起作用 我有一个部分视图页面,有3个单选按钮,即所有员工、指定和确认日期。默认情况下,选择第一个。单击第三个单选按钮后,我需要在文本框中输入日期,然后进行ajax调用,并在div标记中呈现按日期过滤的数据。 ///下面是该局部视图的代码 @模型HRMS.Models.EligibilityCriteriaModel @{ ViewBag.Title=“Index”; } @Html.HiddenFor(modeleItem=>modeleItem.allConfirmationDateEmployeeListCount,新的{id=“confirmationDateEmployeeCount”}) @if(Model.allConfirmationDateEmployeeList!=null) { 员工代码 员工姓名 交付团队 任命 确认日期 挑选 @foreach(Model.allConfirmationDateEmployeeList中的var项) { @DisplayFor(modelItem=>item.EmployeeCode,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.EmployeeName,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.DeliveryTeam,新的{@readonly=“readonly”}) @DisplayFor(modeleItem=>item.Designation,新的{@readonly=“readonly”}) @DisplayFor(modelItem=>item.ConfirmationDate,新的{@readonly=“readonly”}) @Html.CheckBoxFor(modelItem=>item.Checked,新的{@class=“chkAllConfDateEmployees”,@id=item.EmployeeID,@for=item.evaluationyearid}) } },jquery,asp.net-mvc,asp.net-mvc-partialview,Jquery,Asp.net Mvc,Asp.net Mvc Partialview,现在,该视图将在div中呈现。 现在,在我的子部分视图中,我无法获取checkbox.的更改事件,我希望将其作为更改事件 此图显示了一个部分视图页面,该页面具有文本框和搜索按钮。单击按钮时,我需要在搜索按钮下方的div标记中呈现其他部分视图。此视图将具有复选框,并且我复选框更改事件在那里不起作用。 希望你能理解我想说的话。![在此处输入图像描述][1]如果您正在进行局部视图,并且使用JQuery选择器监视更改事件,您可能会遇到两个陷阱之一(注意:如果您没有使用JQuery,这与此无关) 如果JQ

现在,该视图将在div中呈现。 现在,在我的子部分视图中,我无法获取checkbox.的更改事件,我希望将其作为更改事件

此图显示了一个部分视图页面,该页面具有文本框和搜索按钮。单击按钮时,我需要在搜索按钮下方的div标记中呈现其他部分视图。此视图将具有复选框,并且我复选框更改事件在那里不起作用。
希望你能理解我想说的话。![在此处输入图像描述][1]

如果您正在进行局部视图,并且使用JQuery选择器监视更改事件,您可能会遇到两个陷阱之一(注意:如果您没有使用JQuery,这与此无关

  • 如果JQuery脚本在DOM中的元素之上,它将不会在其上执行。要解决这个问题,您应该将所有JQuery选择器(例如,
    $('input').on('change'…)
    放在document.ready事件中。(
    $(document).ready(function(){…您的JQuery在这里…});
  • 如果部分视图是通过AJAX呈现的,则需要重新实例化其中的任何JQuery选择器。它们将在document ready事件之后加载

  • 让我知道这是否有帮助。

    发布您的代码,以及您在控制台中可能遇到的任何错误。@sid D:您也可以发布您的jQuery代码吗?@downvoter:对第一个计时器稍微宽容一点。@sid D:当您连接事件时,DOM中是否存在元素?我发现实际上有一个父部分视图可以呈现子部分视图。如果您看到它的源代码,您将找不到子部分视图的数据。要访问子部分视图,必须在子部分视图页面中编写jquery代码。谢谢大家。如何重新实例化任何jquery选择器?
    I have one partial view page having 3 radio buttons namely All Employees,Designation & Confirmation Date.By default first is selected.on click of third radio button i need to enter date in textbox after that ajax call is made and data filtered by date is renderd in div tag.
    ///the following is code for that partial view
    
    @model HRMS.Models.EligibilityCriteriaModel
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("../../Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
    @{
        ViewBag.Title = "Index";    
    }
    @Html.HiddenFor(modelItem => modelItem.allConfirmationDateEmployeeListCount, new { id = "ConfirmationDateEmpListCount" })
    @if (Model.allConfirmationDateEmployeeList != null)
    {
    <table cellpadding="0" cellspacing="0" border="0" width="100%" id="tbl_allEmployees"
        class="TablesBlueHeaders">
        <thead>
            <tr>
                <th width="10%" class="bluebgtable1">
                    Employee Code
                </th>
                <th class="bluebgtable1" width="15%">
                    Employee Name
                </th>
                <th class="bluebgtable1" width="15%">
                    Delivery Team
                </th>
                <th class="bluebgtable1" width="15%">
                    Designation
                </th>
                <th class="bluebgtable1" width="15%">
                    Confirmation Date
                </th>
                <th class="bluebgtable1" width="15%">
                    Select
                </th>
            </tr>
        </thead>
        <div class="abc" id="SampleID">
            @foreach (var item in Model.allConfirmationDateEmployeeList)
            {
            <tr id="@item.EmployeeID" class="highlightRed">
                <td align="center">
                    @Html.DisplayFor(modelItem => item.EmployeeCode, new { @readonly = "readonly" })
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.EmployeeName, new { @readonly = "readonly" })
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DeliveryTeam, new { @readonly = "readonly" })
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Designation, new { @readonly = "readonly" })
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ConfirmationDate, new { @readonly = "readonly" })
                </td>
                <td align="center">
                    @Html.CheckBoxFor(modelItem => item.Checked, new { @class = "chkAllConfDateEmployees", @id = item.EmployeeID, @for = item.AppraisalYearID })
                </td>
            </tr>
            }
        </div>
    </table>
    }