R
RN1
I have a DataGrid with 7 BoundColumns. A user can login as an admin or
non-admin. When a user logs in as a non-admin & the DatGrid is in the
editable mode, I want only the first 4 columns i.e. the TextBoxes in
the first 4 columns to be editable & the remaining 3 TextBoxes should
remain disabled. This is what I tried (in the OnItemDataBound event
functions):
--------------------
If (sessAdmin = 0) Then
For i = 4 To 6
CType(ea.Item.Cells(i).Controls(0), TextBox).Enabled = False
Next
End If
--------------------
But the above code generates the following error:
--------------------
Specified argument was out of the range of valid values.
Parameter name: index
--------------------
Since the columns are BoundColumns, if I am not mistaken, the
TextBoxes (when the DataGrid is in the editable mode) ought to be
Controls(0) & Cells(4) to Cells(6) are very much present. So why is
this error getting generated?
I even tried the above code in the OnEditCommand event function of the
DataGrid but the same error gets generated.
non-admin. When a user logs in as a non-admin & the DatGrid is in the
editable mode, I want only the first 4 columns i.e. the TextBoxes in
the first 4 columns to be editable & the remaining 3 TextBoxes should
remain disabled. This is what I tried (in the OnItemDataBound event
functions):
--------------------
If (sessAdmin = 0) Then
For i = 4 To 6
CType(ea.Item.Cells(i).Controls(0), TextBox).Enabled = False
Next
End If
--------------------
But the above code generates the following error:
--------------------
Specified argument was out of the range of valid values.
Parameter name: index
--------------------
Since the columns are BoundColumns, if I am not mistaken, the
TextBoxes (when the DataGrid is in the editable mode) ought to be
Controls(0) & Cells(4) to Cells(6) are very much present. So why is
this error getting generated?
I even tried the above code in the OnEditCommand event function of the
DataGrid but the same error gets generated.