开发者

How to change values of Fields in GridView/RadGrid EditTemplate when a chkBox is checked?

开发者 https://www.devze.com 2023-01-20 16:51 出处:网络
When a \'Update\' is clicked the row shows the Edititem mode. I have a check box that when it is \'clicked\' I want the other fields to dissapear/become read-only.

When a 'Update' is clicked the row shows the Edititem mode.

I have a check box that when it is 'clicked' I want the other fields to dissapear/become read-only.

How can this be done client or server side?

My best guess is for server side I have something like this below.. but then in the event how do I get access 开发者_如何转开发to those items in edit mode and change them ?

<EditItemTemplate>
    <asp:CheckBox ID="cbNR" runat="server" AutoPostBack="True" 
        OnCheckedChanged="cbNR_Clicked"
        Checked='<%# Boolean.Parse(Eval("NR").ToString()) %>' />
</EditItemTemplate>


This would be pretty simple using jQuery. Code to hide the other cells when checkbox is checked:

jQuery(function() {
    $("input[id*='cbNR']").click(function() {
      $(this).parents("td").siblings().toggle();
    });
});
0

精彩评论

暂无评论...
验证码 换一张
取 消