I used RepositoryLookupEdit in my 1st Column of Gridview. Using EditValueChanged Event remaining columns fill automatically, till now every thing is working fine. Then I call one Function inside RepositoryLookupEdit, After that very first time this EditValueChanged event fired my Display Member is not shown, it simply shows Null value that i given. Next time if I reselect same column it working fine. What was wrong here ?
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;
}
In this above code if i remove or comment "Taxamountcalc()" then my display member display properly if i enables this function then it show "NullText" only.
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)";
}
}