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

edit column clint side event

2 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mesho100200
Top achievements
Rank 1
mesho100200 asked on 03 Sep 2010, 09:52 PM
hi
i want to get client side event  of link button of edit column
and check cell value in row then return true of false which can continue to server side or not
how can i do that ?

sorry for my English

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 06 Sep 2010, 06:12 AM
Hello Bahgat,

In order to achieve this attach an 'OnCommand' client event to RadGrid and access coresponding cell value in that event handler. Then based on that value perform/cancel the operation like below.

ASPX:
<ClientSettings>
      <ClientEvents OnCommand="OnCommand" />
</ClientSettings>

Java Script:
<script type="text/javascript">
    function OnCommand(sender, args) {
        if (args.get_commandName() == "Edit") {
            var grid = sender;
            var MasterTable = grid.get_masterTableView();
            var row = MasterTable.get_dataItems()[args.get_commandArgument()];
            var cellValue = MasterTable.getCellByColumnUniqueName(row, "EmployeeID").innerHTML; // get cell value using ColumnUniqueName
            if (cellValue == "3")
                args.set_cancel(true); // cancel the edit operation
          }
   }
</script>

Thanks,
Princy.
0
mesho100200
Top achievements
Rank 1
answered on 06 Sep 2010, 07:04 PM
many thanks it's very good Princy
Tags
Grid
Asked by
mesho100200
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mesho100200
Top achievements
Rank 1
Share this question
or