未进入UltraGrid编辑模式



我在九月份问了一个类似的问题(老实说,是相同的),但由于某种原因,这个问题的解决方案在我最近的事件中不起作用。。。

我的UltraGrid现在用于输入订单中每一行的付款日期,并有一个CheckBox列将其标记为已付款。每个订单行付款后,订单将进入下一阶段。

无论如何,当我创建的测试订单被标记为已交付,并到达当前阶段(第5阶段-等待客户付款)时,我最初可以编辑每个订单行上的付款日期和CheckBox列。

但是,如果我将其中一个标记为已付款,并将另一个留空,然后保存,则会出现以下问题。

我进入订单,将下一行标记为已付款。我可以输入付款日期,但不能将CheckBox设置为True。事实上,经过它之后,单元甚至不会进入EditMode,因为CellChange事件不会被触发。

下面CellChange中的代码应该允许CheckBox单元格在输入日期后设置为True,但它没有进入编辑模式。

有人明白为什么会这样吗?

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

没有任何错误,只是没有进入EditMode状态。

上一个案例的解决方案是使用我这次添加的Boolean.Parse行,但这次没有成功。

不是对这个问题的修复,而是我绕过它的一种方法…

我将PaymentDate条目从允许EditMode更改为仅将CheckBox设置为True

然而,最终用户可能不希望这样做,所以这个问题可能仍然没有答案,但就目前而言,这是可行的。

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

最新更新