This is a migrated thread and some comments may be shown as answers.

[Solved] Make LinkButtons not clickable if nothing is selected in radgrid

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cheng
Top achievements
Rank 1
Cheng asked on 22 Feb 2013, 04:01 PM
Hi,

I have a table implemented using radgrid and I have some linkbuttons (add, edit delete) on the top, all these buttons are functional,
however, I wonder if it is possible to make edit and delete not clickable or disabled or invisible if none of the row is selected?



Cheng

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Feb 2013, 04:49 PM
Hello,

Please try with below code snippet.

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      <script type="text/javascript">
          function ValidateGrid() {
              var grid = $find("<%=RadGrid1.ClientID %>");
              if (grid.get_masterTableView().get_selectedItems().length == 0) {
                  return false;
              }
              else {
                  return true;
              }
          }
      </script>
  </telerik:RadCodeBlock>
<telerik:RadGrid ID="RadGrid1" runat="server" >
..............
..............
        </telerik:RadGrid>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="return ValidateGrid();" />


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Cheng
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or