2013-11-28 6 views
0
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로 렌더링됩니다. 내 자식 부분보기에서 나는 change 이벤트를 기대할 수없는 checkbox.which 변경 이벤트를 얻을 수 없습니다.체크 박스 변경 이벤트가 부분보기 내부에서 작동하지 않습니다.

이미지는 텍스트 상자와 검색 버튼이있는 부분보기 페이지를 보여줍니다. 버튼을 클릭하면 검색 버튼 아래 div 태그에 다른 부분보기가 렌더링됩니다.이보기에는 체크 박스가 있고 확인란은 변경 사항이 아닙니다. 저기서 일 해요. 희망 하시겠습니까? [image description here] [1]

+1

후 당신이 코드있어, 그리고 오류가 콘솔에 점점 할 수있다 –

+0

@sid의 D :.. 당신은 당신의 jQuery 코드를 게시 할 수 있습니다 또한 – Thulasiram

+1

@downvoter : 작은 자비를 첫 번째 타이머에 표시하십시오. – naveen

답변

0

부분보기를 수행하고 JQuery 선택기를 사용하여 변경 이벤트를 모니터링하는 경우 두 개의 트랩 중 하나를 실행할 수 있습니다 JQuery와 스크립트가 DOM에서 요소 위에있을 때

  1. : (주 당신이 jQuery를 사용하지 않을 경우,이 무관이다), 그것은 그것을 실행되지 않습니다. 이 문제를 해결하려면 모든 JQuery 선택자를 넣어야합니다 (예 :
  2. 부분보기가 AJAX를 통해 렌더링되는 경우 내부에있는 JQuery 선택기를 다시 인스턴스화해야합니다. 준비 문서 이벤트 후로드

이 도움이 알려줘

+0

JQuery 선택기를 어떻게 다시 인스턴스화합니까? – LearningPal