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

ClientEvents.OnCommand the 'DeleteSelected' command do not Pass this Event Why?

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shijun
Top achievements
Rank 1
Shijun asked on 04 Dec 2013, 08:12 AM
ClientEvents.OnCommand   the 'DeleteSelected' command do not Pass this Event  Why?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Dec 2013, 09:17 AM
Hi Shijun,

I'm not sure about your requirement, i guess you are trying to access a button in OnCommand event. Below is sample showing how to access a GridButtonColumn using CommandName. Please elaborate and give your code if this doesn't help.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" . .  >
    <MasterTableView  ClientDataKeyNames="ID">
        <Columns>
           . . . . . . .
            <telerik:GridButtonColumn CommandName="DeleteSelected" UniqueName="DeleteSelected"
                Text="Delete">
            </telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnCommand="OnCommand" />
    </ClientSettings>
</telerik:RadGrid>

JS:
<script type="text/javascript">
 function OnCommand(sender, args) {
    if (args.get_commandName() == "DeleteSelected") {
        var itemIndex = args.get_commandArgument();
        var rowID = sender.get_masterTableView().get_dataItems()[itemIndex].getDataKeyValue("ID");      
    }
}
</script>

Thanks,
Princy

Tags
Grid
Asked by
Shijun
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or