Question

I created gridview in runtime and attached data source in runtime. Created new column and assign Unbound Expression on that column. When i run this i got only empty column. Help me to solve this. This is my code

OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT InvoiceId, InvoiceNumber, InvoiceDate, Customername AS CustomerId, (Select CustomerName from Customer where Customer.CustomerId = NewInvoice_1.CustomerName) AS Customer_Name, Tax, GrandTotal, CompanyId, InvoiceStatus FROM NewInvoice_1 WHERE CompanyId=" + TXE_CompId.Text + " ", connection);
DataSet sourceDataSet = new DataSet();
adapter.Fill(sourceDataSet);
gridControl1.DataSource = sourceDataSet.Tables[0];

gridView1.Columns.Add(new DevExpress.XtraGrid.Columns.GridColumn()
   {
       Caption = "Total",
       FieldName = "Total",
       VisibleIndex= 3 ,
       UnboundType = DevExpress.Data.UnboundColumnType.Decimal,
       UnboundExpression = "Round([GrandTotal] - [Tax]), 2)"
   });

This is my output screen enter image description here

Was it helpful?

Solution

Did you look into the documentation? Round method doesn't takes two argument.

It takes only one argument. Try this

UnboundExpression = "Round([GrandTotal] - [Tax])"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top