var isDoubleClick = false;
var clickHandler = null;
var ClikedDataKey = null;
function RowClick(sender, args) {
ClikedDataKey = args._dataKeyValues.ID;
isDoubleClick = false;
if (clickHandler) {
window.clearTimeout(clickHandler);
clickHandler = null;
}
clickHandler = window.setTimeout(ActualClick, 200);
}
function RowDblClick(sender, args) {
isDoubleClick = true;
if (clickHandler) {
window.clearTimeout(clickHandler);
clickHandler = null;
}
clickHandler = window.setTimeout(ActualClick, 200);
}
function ActualClick() {
if (isDoubleClick) {
var grid = $find("<%=RadGrid1.ClientID %>");
if (grid) {
var MasterTable = grid.get_masterTableView();
var Rows = MasterTable.get_dataItems();
for (var i = 0; i <
Rows.length
; i++) {
var
row
=
Rows
[i];
if (ClikedDataKey != null && ClikedDataKey == row.getDataKeyValue("ID")) {
MasterTable.fireCommand("MyClick2", ClikedDataKey);
}
}
}
}
else {
var grid = $find("<%=RadGrid1.ClientID %>");
if (grid) {
var MasterTable = grid.get_masterTableView();
var Rows = MasterTable.get_dataItems();
for (var i = 0; i < Rows.length; i++) {
var row = Rows[i];
if (ClikedDataKey != null && ClikedDataKey == row.getDataKeyValue("ID")) {
MasterTable.fireCommand("MyClick1", ClikedDataKey);
}
}
}
}
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "MyClick1")
{
// songle click
//e.CommandArgument -- Get access datakey here
}
else if (e.CommandName == "MyClick2")
{
// Double click
//e.CommandArgument -- Get access datakey here
}
}
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"False"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
>
<
MasterTableView
DataKeyNames
=
"ID"
ClientDataKeyNames
=
"ID"
>
<
Columns
>
...................
................
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
OnRowClick
=
"RowClick"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
Here's the Problem:
Since I'm Firing the Command from CLIENT, in the server RadGrid1_ItemCommand
when I try to Access a Data Row Column via Hidden Field or just using
string STATUS= ((GridDataItem)e.Item).GetDataKeyValue("STATUS").ToString();
or the following
string STATUS= ((DataRowView)e.Item.DataItem)["STATUS"].ToString();
I always get the Value of the first Row, it does not get the value of the row that
was clicked, how do I get the value of the row that was
clicked considering i'm firing it form Client? Thank you.