I asked a similar question (Well, indentical, in honesty) back in September, but the solution to that issue is, for some reason, not working in my latest incident...
My UltraGrid
is being used now to enter the date of payment for each line in the order, and has a CheckBox
column to mark it as paid. When each order line is paid for, the order progresses to the next stage.
Anyway, when the test order that I created is marked as delivered, and reaches the current stage (Stage 5 - Awaiting Customer Payment), I am initially able to edit the payment date and CheckBox
column on each order line.
However, if I mark one as paid, and leave the other one blank and then save it, the following issue arises.
I go into the order to mark the next line as paid for. I am able to enter a date of payment, but not set the CheckBox
to True
. In fact, after stepping through it, the cell doesn't even enter EditMode
, as the CellChange
event is not triggered.
The code in CellChange
below is supposed allow the CheckBox
cell to be set to True
once a date has been entered - However, it isn't entering Edit Mode.
Can anybody see why this would be?
Try
If e.Cell.Column.Key = "PaymentDate" Then
e.Cell.Row.Cells("Customer_Paid").Activation = Activation.AllowEdit
e.Cell.Row.Cells("Customer_Paid").IsInEditMode = True
End If
Catch ex As Exception
errorLog(ex)
End Try
Try
If e.Cell.Column.ToString = "Customer_Paid" Then
Dim customerPaid As Boolean = Boolean.Parse(e.Cell.Text)
If customerPaid = True Then
If IsDBNull(ugProducts.ActiveRow.Cells("PaymentDate").Value) Then
MsgBox("Please enter a payment date", MsgBoxStyle.OkOnly, "Invalid Date")
e.Cell.Row.Cells("Customer_Paid").Value = False
ugProducts.ActiveRow.Appearance.BackColor = Color.White
ugProducts.ActiveRow.Cells("PaymentDate").Value = DBNull.Value
Else
ugProducts.ActiveRow.Appearance.BackColor = Color.LightGreen
ugProducts.ActiveRow.Cells("Product_Price_Per").Appearance.BackColor = Color.LightGreen
End If
e.Cell.Row.Update()
Else
ugProducts.ActiveRow.Appearance.BackColor = Color.White
ugProducts.ActiveRow.Cells("Product_Price_Per").Appearance.BackColor = Color.LightGreen
ugProducts.ActiveRow.Cells("PaymentDate").Value = DBNull.Value
Exit Sub
End If
Else
End If
Catch ex As Exception
errorLog(ex)
End Try
There are no errors, it just doesn't enter the EditMode
state.
The solution with the previous case was to use the Boolean.Parse
line that I've added this time around, yet it is unsuccessful this time.
Not the fix to the issue as such, but a way I got around it...
I changed the PaymentDate
entry from allowing EditMode
, to just setting the CheckBox
to True
.
The end user may not want it done this way, however, so question may still be unanswered, but just for now, this works.
If e.Cell.Column.Key = "PaymentDate" Then
e.Cell.Row.Cells("Customer_Paid").Activation = Activation.AllowEdit
e.Cell.Row.Cells("Customer_Paid").Value = True
End If