asp.net mvc 3 - Enable particular textbox of a row in a telerik grid on click of particular checkbox using jquery -
i have telerik grid having many columns. out of many columns, in columns displaying data through database query. , remaining columns of row having textbox disabled default. in every row, there checkbox. , on checkbox click, want enable disabled textboxes of particular row in checkbox checked:
here code of telerik grid:
<% html.telerik().grid< model>() .name("grid1") .toolbar(toolbar => toolbar.template( html.resource("grid"))) .datakeys(keys => { keys.add(o => o.fname); }) .columns(columns => { columns.bound(m => m.employeeid) .clienttemplate("<input type='checkbox' name='employee1' id='employee1' onclick='return function1(this);'/>") columns.bound(m => m.empname).title("empname").readonly(true).width(70); columns.bound(m => m.task).title("task") .clienttemplate("<input type='textbox' name='task' id='task' disabled='disabled' new { style='width:55px'} value='<#=task#>' />").width(53); }) .databinding(databinding => databinding .ajax() .select("getdata", "home") ) .scrollable() .selectable() .render(); %> i want write jquery this.
can me?
you have show generated html. ever work. suppose grid written out table this:
<table> <tr> <td> <input type='checkbox' name='selectedemployee' id='selectedemployee'/> </td> <td> <input type='text' name='allocation' id='allocation' /> </td> </tr> </table> you can toggle textbox doing this
$('[name="selectedemployee"]').click(function () { var row = $(this).closest('tr'); if ($(this).is(':checked')) { // enable textbox when checkbox checked row.find('#allocation').removeattr('disabled'); } else { // disable textbox when checkbox unchecked row.find('#allocation').attr('disabled','disabled'); } });
Comments
Post a Comment