Hi all,
I'm attempting to control users ability to enter data on a webpage. In this instance I only want them to be able to edit the data that is there, so if the property has no value, then the control will be disabled. I seem to have run into a problem. The code below only seems to work on each odd row of the GridView. So the first row they cannot edit the empty controls, second row they can, third row they cannot, etc... Apologies if I have missed something obvious, but I'm the only programmer where I work and a second pair of eyes is really handy every now and then.
EndDateAsDate is a property which gets is value from a SQL database. I have checked the data in the SQL database and it is Null for each row, yet the code only works on odd rows. Any help is appreciated.
Cheers,
Cuddles
I'm attempting to control users ability to enter data on a webpage. In this instance I only want them to be able to edit the data that is there, so if the property has no value, then the control will be disabled. I seem to have run into a problem. The code below only seems to work on each odd row of the GridView. So the first row they cannot edit the empty controls, second row they can, third row they cannot, etc... Apologies if I have missed something obvious, but I'm the only programmer where I work and a second pair of eyes is really handy every now and then.
VB.NET:
If e.Row.RowType = DataControlRowType.DataRow Then
Dim personnelUnit As PersonnelUnit = CType(e.Row.DataItem, PersonnelUnit)
Select Case e.Row.RowState
Case DataControlRowState.Edit
If personnelUnit.EndDateAsDate.IsEmpty Then
EndDateAsDate is a property which gets is value from a SQL database. I have checked the data in the SQL database and it is Null for each row, yet the code only works on odd rows. Any help is appreciated.
Cheers,
Cuddles