views:

41

answers:

1

Hi, I have one grid view that contains some template columns. In this, the first column contains check boxes named as Read, fourth and fifth column contains asp:link button. If the user clicks on the read check box, both link buttons should be enabled (Initially it is in disabled mode). I used this JavaScript code for disabling. But i didn't get the solution. Please help me for acheiving this solution. Thanks in advance..

 function EnablePermissoin(chkB, cellNumber1, cellNumber2) {
        var IsChecked = chkB.checked;
        if (IsChecked) {

            var cell = chkB.parentElement.parentElement.cells[cellNumber1];
            for (i = 0; i < cell.childNodes.length; i++) {
                if (cell.childNodes[i].type == "linkbutton") {

                    cell.childNodes[i].disabled = false;
                }
            }

        }
    }
  <asp:TemplateColumn HeaderText="Read" ItemStyle-HorizontalAlign="Center">
                                                                        <ItemTemplate>
                                                                            <asp:CheckBox ID="chkRead" runat="server" Text='<%# Eval("Read") %>' onclick="javascript:EnablePermissoin(this,5,6);" />
                                                                        </ItemTemplate>
                                                                    </asp:TemplateColumn>
+1  A: 

Linkbutton is rendered as anchor (a) tag is java-script. So you need to modify part of your script as

...
    if (cell.childNodes[i].tagName == "A") {
          cell.childNodes[i].disabled = false;
    }
...
VinayC
Hey, Thanks a lot.. Its working now..
Dilse Naaz