I have been looking for a means to find a radcombo control where I know the name of the control (for example RadCombo ID =" RadComboColumn1" ) in a radGrid header... CLIENT SIDE JAVASCRIPT
Any suggestions?
While this code works on the serverside, I am needing to convert this to the clientside:
Any suggestions?
function confirmCallBackFn(arg) {
if (arg == false) {
$.unblockUI();
return false;
}
$.unblockUI();
var grid = $find("<%=RadGridImport.ClientID %>");
var masterTableView = grid.get_masterTableView();
var columns = masterTableView.get_columns();
var columnCount = masterTableView.get_columns().length;
//TODO: Loop and get collection of radcombo's in headers and selected value.
var selectedColumnFields = new Array();
for (var i = 0; i <
columnCount
; i++) {
//TODO: Find control in radgrid hearder.
var
col
=
columns
[i]????????;
var RadCombo = ????
//.get_item().findControl("columm1");
}
__doPostBack("<%= FinishButton.UniqueID %>", "");
return true;
}
While this code works on the serverside, I am needing to convert this to the clientside:
var columnComboBox = headers[0].FindControl(columnName)
as
RadComboBox;
private
List<ValueName> GetUserSelectedColumnMapping()
{
//Get the number of columns in the dynamic grid -2 hidden columns
int
radGridColumnCount = RadGridImport.MasterTableView.RenderColumns.Count() - 2;
//Selected Column Type Mapping translates a dynamic column to a valid database table field.
var selectedColumnTypeMapping =
new
List<ValueName>();
GridItem[] headers = RadGridImport.MasterTableView.GetItems(GridItemType.Header);
for
(
int
i = 0; i < radGridColumnCount; i++)
{
string
columnName = String.Format(
"Column{0}"
, i);
//Column{value} is set in the radgrid item created event.
var columnComboBox = headers[0].FindControl(columnName)
as
RadComboBox;
string
selectedText =
string
.Empty;
if
(columnComboBox !=
null
)
{
var selected = columnComboBox.SelectedValue;
if
(columnComboBox.SelectedItem !=
null
)
{
selectedText = columnComboBox.SelectedItem.Text;
}
//Add the users selection to the mapping list.
selectedColumnTypeMapping.Add(
new
ValueName() { Name = selectedText, Value = selected, ColumnIndex = i });
}
}
return
selectedColumnTypeMapping;
}