2013-11-28 41 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格式呈現。 現在在我的孩子局部視圖中,我無法獲得checkbox.change的變化事件,我想指望更改事件。複選框更改事件不適用於局部視圖mvc

該圖像顯示了一個部分視圖頁面有一個文本框和搜索button.on按鈕單擊我需要呈現其他部分視圖下面的搜索button.this視圖將具有複選框,我複選框更改事件不是在那邊工作。 希望你能明白我想說的是什麼![輸入圖片描述] [1]

+1

後你的代碼,你可以在控制檯中得到任何錯誤 –

+0

@sid d:你可以發表你的jQuery代碼也可以嗎? – Thulasiram

+1

@downvoter:顯示第一個計時器有點憐憫 – naveen

回答

0

如果你正在做部分視圖,並使用JQuery選擇器監視更改事件,則可以運行到兩個陷阱之一(注:如果你不使用JQuery,這是無關緊要的

  1. 如果jQuery腳本是在DOM你的元素之上,也不會在它執行。爲了解決這個問題,你應該把所有的jQuery選擇器(例如$('input').on('change'...)在一個document.ready事件中)($(document).ready(function() { ... your jquery here ...});
  2. 如果你的部分視圖是通過AJAX呈現的,你需要重新實例化它們中的任何JQuery選擇器。文檔準備事件發生後加載

讓我知道,如果這有助於

+0

如何重新實例化任何JQuery選擇器? – LearningPal