1
我在Gridview的第一列中使用了RepositoryLookupEdit。使用EditValueChanged事件剩余列自动填充,直到现在,每件事情都正常工作。然后我在RepositoryLookupEdit中调用一个Function,在第一次这个EditValueChanged事件触发我的显示成员后,它不显示,它只是显示我给出的空值。下次如果我重新选择相同的列它工作正常。这里有什么问题?显示成员在Winforms Gridview Devexpress的RepositoryLookupEdit中第一次触发事件时不显示?
private void repositoryItemGridLookUpEdit1_EditValueChanged(object sender, EventArgs e)
{
GridLookUpEdit LookupEdit = sender as GridLookUpEdit;
DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
gridView1.SetFocusedRowCellValue("Description", SelectedDataRow["ProductDescription"]);
gridView1.SetFocusedRowCellValue("UoM", SelectedDataRow["UnitofMeasure"]);
gridView1.SetFocusedRowCellValue("Quantity", SelectedDataRow["DefaultQuantity"]); //UnitPrice
gridView1.SetFocusedRowCellValue("UnitPrice", SelectedDataRow["MRPPrice"]);
gridView1.SetFocusedRowCellValue("DiscountPercentage", SelectedDataRow["Discount"]);
gridView1.SetFocusedRowCellValue("DiscountAmount", SelectedDataRow["DiscountAmount"]);
gridView1.SetFocusedRowCellValue("TaxInPercentage", SelectedDataRow["Taxid1"]);
Taxamountcalc(); // function to calculate taxamount
rowcount = gridView1.RowCount;
}
在该上述代码如果删除或评价“Taxamountcalc()”然后我的显示部件显示正常,如果我启用此功能则仅显示“NullText”。
private void Taxamountcalc()
{
if (barCheckItem1.Checked)
{
TaxAmount.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
TaxAmount.UnboundExpression = "Round([UnitTotal] * ([TaxInPercentage]/100), 2)";
}
else if (!(barCheckItem1.Checked))
{
TaxAmount.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
TaxAmount.UnboundExpression = "Round(([UnitPrice] * ([TaxInPercentage]/100)) * [Quantity], 2)";
}
}
你能否提供一些代码? – SidAhmed
嗨锡德,我更新了我的问题。 – Srihari
谢谢,你能添加TaxAmountCalc()方法的代码吗? – SidAhmed