I currently have a Grid with two rad comboboxes that are being displayed in the grid using tooltips and being handled by the batchManagerExtentions.js library. The first combobox selection populates the second combobox and once that selection is made that is the value I need to be stored inside of the Database. Once the selections have been made and the save all changes button has been clicked on the BatchEditCommand function where I am creating the newValues Hashtables the values are all thrown off, but they are being populated inside of the List<> correctly with the correct name / value / relation. I've attached screenshots, JS code, markup and code behind. Any help would be great!
Markup:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGridUser"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridUser"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridWorkArea"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RelatedComboBoxesToolTip"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGridWorkArea"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RelatedComboBoxesToolTip"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadToolTip
runat
=
"server"
ID
=
"RelatedComboBoxesToolTip"
OffsetY
=
"0"
RenderInPageRoot
=
"false"
HideEvent
=
"FromCode"
AutoCloseDelay
=
"0"
RelativeTo
=
"Element"
CssClass
=
"RelatedCombosToolTip"
ShowEvent
=
"FromCode"
Position
=
"Center"
Skin
=
"Default"
>
<
telerik:RadComboBox
runat
=
"server"
Width
=
"100%"
EnableLoadOnDemand
=
"true"
OnItemsRequested
=
"RadComboBox1_ItemsRequested"
>
</
telerik:RadComboBox
>
<
telerik:RadToolTip
runat
=
"server"
Skin
=
"Metro"
OffsetY
=
"0"
EnableShadow
=
"false"
ShowEvent
=
"FromCode"
Position
=
"TopCenter"
></
telerik:RadToolTip
>
</
telerik:RadToolTip
>
<
telerik:RadGrid
ID
=
"RadGridWorkArea"
runat
=
"server"
DataSourceID
=
"WorkAreaDataSource"
Width
=
"1000px"
OnItemCommand
=
"RadGridWorkArea_ItemCommand"
AutoGenerateDeleteColumn
=
"true"
OnItemDataBound
=
"RadGridWorkArea_ItemDataBound"
ShowFooter
=
"true"
AllowAutomaticUpdates
=
"false"
OnBatchEditCommand
=
"RadGridWorkArea_BatchEditCommand"
>
<
MasterTableView
EditMode
=
"Batch"
CommandItemDisplay
=
"Top"
AutoGenerateColumns
=
"false"
DataKeyNames
=
"bpSystemUserAssignID"
>
<
ItemStyle
Height
=
"40px"
/>
<
AlternatingItemStyle
Height
=
"40px"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"bpSystemUserAssignID"
UniqueName
=
"bpSystemUserAssignID"
ReadOnly
=
"true"
HeaderText
=
"ID"
Visible
=
"false"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"bpSystemID"
UniqueName
=
"bpSystemID"
HeaderText
=
"System"
HeaderStyle-Width
=
"250px"
>
<
ItemTemplate
>
<%# Eval("bpSystemName") %>
</
ItemTemplate
>
<
EditItemTemplate
></
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"bpSubSystemID"
UniqueName
=
"bpSubSystemID"
HeaderText
=
"Sub-System"
HeaderStyle-Width
=
"250px"
>
<
ItemTemplate
>
<%# Eval("bpSubSystemName")%>
</
ItemTemplate
>
<
EditItemTemplate
></
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"Template1"
HeaderStyle-Width
=
"60px"
HeaderText
=
"Work Area Percentage"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"percentLbl"
runat
=
"server"
Text='<%# Eval("bpWorkPercentage") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"TextBox1"
runat
=
"server"
DbValue='<%# Eval("bpWorkPercentage") %>' Type="Percent" NumberFormat-DecimalDigits="0">
<
ClientEvents
OnBlur
=
"Blur"
OnFocus
=
"Focus"
/>
</
telerik:RadNumericTextBox
>
</
EditItemTemplate
>
<
FooterTemplate
>
<
telerik:RadNumericTextBox
ID
=
"TextBox2"
runat
=
"server"
Type
=
"Percent"
NumberFormat-DecimalDigits
=
"0"
>
<
ClientEvents
OnLoad
=
"Load"
/>
</
telerik:RadNumericTextBox
>
</
FooterTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnUserAction
=
"userAction"
OnGridCreated
=
"gridCreated"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
protected
void
RadGridWorkArea_BatchEditCommand(
object
sender, GridBatchEditingEventArgs e)
{
List<DemoItem> subsystemIDs = (List<DemoItem>)Session[
"subsystems"
];
foreach
(GridBatchEditingCommand command
in
e.Commands)
{
if
(command.Type == GridBatchEditingCommandType.Update)
{
Hashtable newValues = command.NewValues;
Hashtable oldValues = command.OldValues;
string
id = newValues[
"bpSubSystemID"
].ToString();
}
}
}
JS
var
grid1Validator;
function
gridCreated(sender, args) {
// == Batch Editing - Related ComboBoxes Manager ==
var
relatedComboBoxesManager =
new
BatchExtensions.RelatedComboBoxesManager().init({
grid: sender,
toolTipID:
"<%=RelatedComboBoxesToolTip.ClientID%>"
,
relations: [
{
columnName:
"bpSystemID"
},
{
columnName:
"bpSubSystemID"
,
relatedTo:
"bpSystemID"
}
]
});
// == Batch Editing - Validation Manager ==
grid1Validator =
new
BatchExtensions.ValidationManager().init({
grid: sender,
validators: [
{
columnName:
"bpSystemID"
,
errorMessage:
"- Required -"
},
{
columnName:
"bpSubSystemID"
,
errorMessage:
"- Required -"
},
{
columnName:
"Template1"
,
errorMessage:
""
,
toolTipMessage:
"Select a positive number"
,
validationFunction:
function
(value) {
return
value >= 0;
}
},
]
});
}
function
userAction(sender, args) {
//You can use this event to alert the user that there are changes in the grid and
//cancel operations like paging, filtering, etc.
//debugger;
if
(!grid1Validator.isValid()) {
args.set_cancel(
true
);
}
}
function
PopUpShowing(sender, eventArgs) {
popUp = eventArgs.get_popUp();
var
gridWidth = sender.get_element().offsetWidth;
var
gridHeight = sender.get_element().offsetHeight;
var
popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf(
"px"
));
var
popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf(
"px"
));
popUp.style.left = ((gridWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() +
"px"
;
popUp.style.top = ((gridHeight - popUpHeight) / 2 + sender.get_element().offsetTop).toString() +
"px"
;
}
function
RowDblClick(sender, eventArgs) {
sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
}
Thanks,
Ramey