Hello,
I'm currently using the RadGrid control with a delete button I've added to the "CommandItemTemplate" section. When the user selects certain rows and clicks delete, a client side event is called "delete_click". This function iterates over each selected row to build up an array of parameters which should include the primary key of the row. I'm currently using hidden columns to hold certain values needed in this function. Certain values are IsUserAdmin, userRole, and userId - but none of these should be displayed as a column in the grid.The primary key (data key) is userId.... "<MasterTableView DataKeyNames='userId'>
Question #1: Is there a better approach for associating these values with a row instead of hidden columns? You can see in the example below, to access the row's column "IsUserAdmin", I access the column by it's unique name. This is a column in the grid that is hidden. Can I associate this without using a hidden column as a better approach?
Below is an example of how I access the cells for each selected row.
var grid = $find("<%=grdSummary.ClientID %>");
var MasterTable = grid.get_masterTableView();
var selectedRows = MasterTable.get_selectedItems();
var parms = new Array();
for (var i = 0; i < selectedRows.length; i++) {
{
var row = selectedRows[i];
parm = new ScheduleSummaryParms();
// Retrieve Cell by column
parm.IsAdmin = MasterTable.getCellByColumnUniqueName(row, "userIsAdmin").innerHTML;
parm.userRole = MasterTable.getCellByColumnUniqueName(row, "userIsAdmin").innerHTML;
parms[i] = parm;
}
Question #2: Is there a way to access the row's primary key. I've been thinking about adding a hidden column for the primary key, but I thought there had to be a better way. I've seen examples using "getDataKeyValue", but this doesnt seem to work.
Thanks!!
I'm currently using the RadGrid control with a delete button I've added to the "CommandItemTemplate" section. When the user selects certain rows and clicks delete, a client side event is called "delete_click". This function iterates over each selected row to build up an array of parameters which should include the primary key of the row. I'm currently using hidden columns to hold certain values needed in this function. Certain values are IsUserAdmin, userRole, and userId - but none of these should be displayed as a column in the grid.The primary key (data key) is userId.... "<MasterTableView DataKeyNames='userId'>
Question #1: Is there a better approach for associating these values with a row instead of hidden columns? You can see in the example below, to access the row's column "IsUserAdmin", I access the column by it's unique name. This is a column in the grid that is hidden. Can I associate this without using a hidden column as a better approach?
Below is an example of how I access the cells for each selected row.
var grid = $find("<%=grdSummary.ClientID %>");
var MasterTable = grid.get_masterTableView();
var selectedRows = MasterTable.get_selectedItems();
var parms = new Array();
for (var i = 0; i < selectedRows.length; i++) {
{
var row = selectedRows[i];
parm = new ScheduleSummaryParms();
// Retrieve Cell by column
parm.IsAdmin = MasterTable.getCellByColumnUniqueName(row, "userIsAdmin").innerHTML;
parm.userRole = MasterTable.getCellByColumnUniqueName(row, "userIsAdmin").innerHTML;
parms[i] = parm;
}
Question #2: Is there a way to access the row's primary key. I've been thinking about adding a hidden column for the primary key, but I thought there had to be a better way. I've seen examples using "getDataKeyValue", but this doesnt seem to work.
Thanks!!