【发布时间】:2013-11-28 12:13:21
【问题描述】:
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]
【问题讨论】:
-
发布您的代码,以及您在控制台中可能遇到的任何错误。
-
@sid D:你能把你的jQuery代码也贴出来吗?
-
@downvoter:对第一次来的人有点仁慈。
-
@sid D: 连接事件时元素是否存在于 DOM 中?
-
我发现实际上有一个父局部视图将呈现子局部视图的方式。如果您查看其源代码,您将找不到子局部视图的数据。访问子局部视图必须编写子部分视图页面中的 jquery 代码。谢谢大家。
标签: jquery asp.net-mvc asp.net-mvc-partialview