Hello.
How to change the value of GridTemplateColumn.
I have this complicated situation. I have Grid in BatchEdit mode, using load-on-demand, using client and server validation, containing GridTemplateColumns with RadComboBoxes which are cascade-depended on each other also in load-on-demand mode. I am aware, I am using multiple features, which perhaps are not working well together by default, but that was never a problem for me.
Almost everything is well. When an edited row is not validated on the server, this row is recreated on the client after postback. If the existing row was changed, this row is edited, if it was a new row, this row is created and populated.
I have a problem set GridTemplateColumn value properly because there are 2 values: display value and id value. I cannot use the standard function "batchEditingManager.changeCellValue" because I either use display value and I have wrong information on the server or I use id value and the user cannot see proper values. If I combine the second solution and change the innerText of the column, the grid will start to have weird errors. If I use some other solution, I don't have values on the server during the BatchEdit command (GridBatchEditingCommand.NewValues).
In short:
I need to change value of GridTemplateColumn on the client, show display value to the user in the row and have id value on postback in GridBatchEditingCommand.NewValues.
I need to do this on the client, I think I cannot use server row binding.
Grid collumn:
<
telerik:GridTemplateColumn
HeaderText
=
"Projekt"
UniqueName
=
"PROJECT_ID"
DataField
=
"PROJECT_ID"
SortExpression
=
"PROJECT_ID"
HeaderStyle-Width
=
"15%"
ItemStyle-Width
=
"15%"
>
<
ItemStyle
Wrap
=
"false"
CssClass
=
"addTooltyp TypeRadComboBox"
/>
<
ItemTemplate
>
<
label
id
=
'GridComboBoxValue'
tag='<%#SafeEval( Container.DataItem, "PROJECT_ID")%>'><%#SafeEval( Container.DataItem, "PROJECT_NAME")%></
label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"GCB_Project"
ShowMoreResultsBox
=
"true"
EnableVirtualScrolling
=
"true"
EnableLoadOnDemand
=
"true"
Width
=
"100%"
Height
=
"300"
ItemsPerRequest
=
"10"
DropDownAutoWidth
=
"Enabled"
ItemRequestTimeout
=
"800"
DataTextField
=
"PROJECT_FULL_NAME"
DataValueField
=
"PROJECT_ID"
AllowCustomText
=
"false"
MarkFirstMatch
=
"true"
OnItemsRequested
=
"Combobox_ItemsRequested"
OnClientItemsRequesting
=
"ComboBoxOnClientItemsRequesting"
OnClientFocus
=
"CBOnClientFocus"
OnClientBlur
=
"OnClientBlurHandler"
>
</
telerik:RadComboBox
>
<
asp:CustomValidator
ID
=
"ProjectValidator"
runat
=
"server"
EnableClientScript
=
"true"
ClientValidationFunction
=
"DropdownValidatorFun"
ControlToValidate
=
"GCB_Project"
>
</
asp:CustomValidator
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
Thank you.