Hi
We have Batch editable grid with GridBoundColumns and GridTemplateColumns because of need checkbox / combobox. Some columns are editable and some read only by default or set read only by user rights to do changes (on page loading events set column to readonly). All possible changeable columns are set to ForceExtractValue="true" that those are available on ObjectDataSource updating event parameters. But when GridTemplateColumn is changed to readonly, value is not there anymore. What we do wrong?
Here is aspx file columns both normal (and always readonly column) and template column (changed code behind to read only):
01.
<
telerik:GridBoundColumn
DataField
=
"PrintHeader"
HeaderText
=
"Print Header"
SortExpression
=
"PrintHeader"
UniqueName
=
"PrintHeader"
FilterControlAltText
=
"Filter PrintHeader column"
ReadOnly
=
"True"
HeaderStyle-Width
=
"200px"
ItemStyle-Width
=
"200px"
ForceExtractValue
=
"Always"
></
telerik:GridBoundColumn
>
02.
03.
<
telerik:GridTemplateColumn
UniqueName
=
"ApprovalInspectionPoint"
DataField
=
"ApprovalInspectionPoint"
HeaderText
=
"Insp. point"
FilterControlAltText
=
"Filter ApprovalInspectionPoint column"
SortExpression
=
"ApprovalInspectionPoint"
ColumnGroupName
=
"Record"
ForceExtractValue
=
"Always"
>
04.
<
HeaderStyle
Width
=
"50px"
></
HeaderStyle
>
05.
<
ItemStyle
Width
=
"40px"
></
ItemStyle
>
06.
<
ItemTemplate
>
07.
<
telerik:RadLabel
ID
=
"lblApprovalInspectionPoint"
runat
=
"server"
Text='<%# Eval("ApprovalInspectionPoint") %>' Width="40px"></
telerik:RadLabel
>
08.
</
ItemTemplate
>
09.
<
EditItemTemplate
>
10.
<
telerik:RadComboBox
ID
=
"cmbApprovalInspectionPoint"
runat
=
"server"
DataSourceID
=
"odsInspectionPoint"
DataTextField
=
"COD"
DataValueField
=
"COD"
Width
=
"40px"
></
telerik:RadComboBox
>
11.
</
EditItemTemplate
>
12.
</
telerik:GridTemplateColumn
>
Here are couple different users run situation for same row from ObjectDataSource OnUpdating event.
Event code from where debug watch compare lists:
1.
protected
void
odsITP_Updating(
object
sender, ObjectDataSourceMethodEventArgs e)
2.
{
3.
ITP rowToUpdate = e.InputParameters[0]
as
ITP;
4.
ITP rowToCompare = ....
//Data from DB
5.
...
Result from debug watch (some formatting to show properly) with user where all are enabled:
1.
rowToUpdate.ID 43579
int
?
2.
rowToCompare.ID 43579
int
?
3.
rowToUpdate.PrintHeader
"Production Welding Monitoring"
string
4.
rowToCompare.PrintHeader
"Production Welding Monitoring"
string
5.
rowToUpdate.ApprovalInspectionPoint
"H"
string
6.
rowToCompare.ApprovalInspectionPoint
"H"
string
7.
(grITPS.Columns.FindByUniqueName(
"PrintHeader"
)
as
GridBoundColumn).ReadOnly
true
bool
8.
(grITPS.Columns.FindByUniqueName(
"ApprovalInspectionPoint"
)
as
GridTemplateColumn).ReadOnly
false
bool
And result with user where that approvalcheckpoint column is read only (compare rows 5 and 8 to above):
1.
rowToUpdate.ID 43579
int
?
2.
rowToCompare.ID 43579
int
?
3.
rowToUpdate.PrintHeader
"Production Welding Monitoring"
string
4.
rowToCompare.PrintHeader
"Production Welding Monitoring"
string
5.
rowToUpdate.ApprovalInspectionPoint
null
string
6.
rowToCompare.ApprovalInspectionPoint
"H"
string
7.
(grITPS.Columns.FindByUniqueName(
"PrintHeader"
)
as
GridBoundColumn).ReadOnly
true
bool
8.
(grITPS.Columns.FindByUniqueName(
"ApprovalInspectionPoint"
)
as
GridTemplateColumn).ReadOnly
true
bool
Regards
Harri