Hello everyone,
i need your help for getting the value of the DataField from ClientDataKeyNames array of the MasterTable and even without AllowRowSelect = "True"
All I need is to CLICK BUTTON ONLY WITHOUT AllowRowSelect = True
Once I click "Remove Location" button, I am still getting error that we don't get any values from ClientDataKeyName.
In UserControl
<telerik:RadScriptBlock ID=
"RadScriptBlock1"
runat=
"server"
>
<script type=
"text/javascript"
>
function
OnClientClickingApprovedLocations(sender, args) {
var
callBackFunction2 = Function.createDelegate(sender,
function
(argument) {
if
(argument) {
this
.click();
}
});
var
Master = $find(
"<%=rgRequestorlocations.ClientID %>"
).get_masterTableView();
var
SelectedItem = Master.get_selectedItems()[0];
var
location_name = SelectedItem.getDataKeyValue(
"location_name"
);
// get the DataKeyValue of selected item
var
role = SelectedItem.getDataKeyValue(
"role"
);
var
duty = SelectedItem.getDataKeyValue(
"duty"
);
if
(duty ==
"P"
) {
if
(role ==
"Privacy Officer"
) {
roletext =
"Are you sure you want to remove this role location?"
;
radconfirm(roletext, callBackFunction2, 300, 100,
null
,
"Delete"
);
args.set_cancel(
true
);
}
else
{
roletext =
"Please confirm the Primary "
+ role +
" for "
+ location_name +
" will be removed "
+
""
+
"?"
;
radconfirm(roletext, callBackFunction2, 300, 100,
null
,
"Delete"
);
args.set_cancel(
true
);
}
}
else
{
roletext =
"Are you sure you want to remove this role location?"
;
radconfirm(roletext, callBackFunction2, 300, 100,
null
,
"Delete"
);
args.set_cancel(
true
);
}
}
</script>
</telerik:RadScriptBlock>
<
telerik:RadGrid
ID
=
"rgRequestorlocations"
runat
=
"server"
AutoGenerateColumns
=
"False"
CellSpacing
=
"0"
GridLines
=
"None"
OnNeedDataSource
=
"rgRequestorlocations_NeedDataSource"
OnItemCommand
=
"rgRequestorlocations_ItemCommand"
OnItemDataBound
=
"rgRequestorlocations_ItemDataBound"
>
<
MasterTableView
DataKeyNames
=
"location_pk, user_id, role,location_name, duty"
ClientDataKeyNames
=
"location_pk, user_id, role,location_name, duty"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
/>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
Visible
=
"True"
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
Visible
=
"True"
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"user_id"
FilterControlAltText
=
"Filter location_pk column"
HeaderText
=
"User ID"
UniqueName
=
"user_id"
Visible
=
"False"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"location_pk"
FilterControlAltText
=
"Filter location_pk column"
HeaderText
=
"Location ID"
UniqueName
=
"location_pk"
Visible
=
"False"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"location_name"
FilterControlAltText
=
"Filter location_name column"
HeaderText
=
"Location Name"
UniqueName
=
"location_name"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"role"
FilterControlAltText
=
"Filter role column"
HeaderText
=
"Role"
UniqueName
=
"role"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"duty"
FilterControlAltText
=
"Filter role column"
HeaderText
=
"duty"
UniqueName
=
"duty"
Visible
=
"false"
></
telerik:GridBoundColumn
>
<%-- <
telerik:GridButtonColumn
ButtonType
=
"PushButton"
FilterControlAltText
=
"Filter deletecolumn column"
ConfirmText
=
"Are you sure you want to remove this role location?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Remove Role Location?"
HeaderText
=
"Remove Role"
Text
=
"Remove Role"
UniqueName
=
"deletecolumn"
CommandName
=
"DeleteRoleLocation"
>
</
telerik:GridButtonColumn
>--%>
<
telerik:GridTemplateColumn
UniqueName
=
"rbDelete"
>
<
ItemTemplate
>
<
telerik:RadButton
ID
=
"rbDelete"
onr
runat
=
"server"
Text
=
"Remove Role"
OnClientClicking
=
"OnClientClickingApprovedLocations"
Value
=
""
CommandName
=
"DeleteRoleLocation"
>
</
telerik:RadButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
></
EditColumn
>
</
EditFormSettings
>
<
PagerStyle
PageSizeControlType
=
"RadComboBox"
/>
</
MasterTableView
>
<
PagerStyle
PageSizeControlType
=
"RadComboBox"
/>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
></
Selecting
>
</
ClientSettings
>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
</
telerik:RadGrid
>