We're in the process of converting our website from the old RadControls ASP.NET suite to the new "prometheus" one. On the whole it's gone relatively easy, except for one rather awkward function that we needed.
Basically, we have a RadGrid with a GridTemplateColumn, (plus others but they don't affect this), that contains a RadComboBox. What we needed was when the user presses the [enter] in one RadComboBox, it needs to select a default option in that control and then set focus to the RadComboBox on the following row, (if there is one of course). [This is done client-side for speed reasons, via each RadComboBox's ClientKeyPressing event].
After some research we've updated most of the javascript, except for two aspects;
1) Finding the grid row's index for the RadComboBox that received the [enter] button. The javascript we're currently using is;
var intRowIndex = pobjCombo.get_inputDomElement().parentNode.parentNode.parentNode.rowIndex - 1;
Where "pobjCombo" is the RadComboBox control that the event's being raised for.
2) Setting focus to the RadComboBox in the next row. Currently we have the following to focus onto the next row's control, which was supplied by someone from telerik;
var objNextRow = objGrid.get_masterTableView().get_dataItems()[intNextRowIndex];
// a) Find the necessary cell within this next row.
var objCell = objNextRow.get_element().cells[intCellIndex];
// b) Locate the correct combo-box within this cell, which will depend on the type of node this is for.
var objControl;
if (objCell.childNodes[0].nodeName == "DIV")
{
objControl = objCell.childNodes[0].childNodes[1].childNodes[0];
}
else
{
objControl = objCell.childNodes[1].childNodes[2].childNodes[0];
}
// c) Make sure this new control has focus.
objControl.focus();
Notes: "intNextRowIndex" is the row's index that we want to select its RadComboBox for, "objGrid" is the RadGrid we're processing for, and "intCellIndex" is the column's index containing the GridTemplateColumn. The latter two of these we're able to find without issue, (for the first see point (1)).
Could you please amend the included javascript code we've been using for the new ASP.NET AJAX RadControls suite.
Paul H
Basically, we have a RadGrid with a GridTemplateColumn, (plus others but they don't affect this), that contains a RadComboBox. What we needed was when the user presses the [enter] in one RadComboBox, it needs to select a default option in that control and then set focus to the RadComboBox on the following row, (if there is one of course). [This is done client-side for speed reasons, via each RadComboBox's ClientKeyPressing event].
After some research we've updated most of the javascript, except for two aspects;
1) Finding the grid row's index for the RadComboBox that received the [enter] button. The javascript we're currently using is;
var intRowIndex = pobjCombo.get_inputDomElement().parentNode.parentNode.parentNode.rowIndex - 1;
Where "pobjCombo" is the RadComboBox control that the event's being raised for.
2) Setting focus to the RadComboBox in the next row. Currently we have the following to focus onto the next row's control, which was supplied by someone from telerik;
var objNextRow = objGrid.get_masterTableView().get_dataItems()[intNextRowIndex];
// a) Find the necessary cell within this next row.
var objCell = objNextRow.get_element().cells[intCellIndex];
// b) Locate the correct combo-box within this cell, which will depend on the type of node this is for.
var objControl;
if (objCell.childNodes[0].nodeName == "DIV")
{
objControl = objCell.childNodes[0].childNodes[1].childNodes[0];
}
else
{
objControl = objCell.childNodes[1].childNodes[2].childNodes[0];
}
// c) Make sure this new control has focus.
objControl.focus();
Notes: "intNextRowIndex" is the row's index that we want to select its RadComboBox for, "objGrid" is the RadGrid we're processing for, and "intCellIndex" is the column's index containing the GridTemplateColumn. The latter two of these we're able to find without issue, (for the first see point (1)).
Could you please amend the included javascript code we've been using for the new ASP.NET AJAX RadControls suite.
Paul H