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>
}
现在这个视图将以div格式呈现。 现在,在我的孩子局部视图中,我无法获得复选框的更改事件。我想依靠更改事件。
图像显示部分视图页面,其中包含文本框和搜索按钮。单击按钮,我需要在搜索按钮下方的div标签中呈现其他部分视图。此视图将有复选框,并且我复选框更改事件不起作用在那边。 希望你能理解我想说的话。![在这里输入图像描述] [1]
答案 0 :(得分:0)
如果您正在使用JQuery选择器进行部分视图和监视更改事件,则可以遇到两个陷阱之一(注意:如果您不使用JQuery,这是无关紧要的)
$('input').on('change'...)
)放入document.ready事件中。($(document).ready(function() { ... your jquery here ...});
如果有帮助,请告诉我。