<asp:DataGrid id='DataGrid1' runat='server'></asp:DataGrid>
VB.NET
’Fill the DataSet ds with data from database
Dim dc As DataColumn
dc = New DataColumn('Total', Type.GetType('System.Double'))
dc.Expression = 'UnitPrice * UnitsInStock'
ds.Tables(0).Columns.Add(dc)
DataGrid1.DataSource = ds
DataGrid1.DataBind()
C#
//Fill the DataSet ds with data from database
DataColumn dc ;
dc = new DataColumn('Total', Type.GetType('System.Double'));
dc.Expression = 'UnitPrice * UnitsInStock';
ds.Tables[0].Columns.Add(dc);
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
Share with