Click to See Complete Forum and Search --> : how to add values that have been calculated in the codes to a column in the datagrid?


HFB
July 16th, 2003, 03:44 AM
:( hi

i need to add two dates and display the result in a column in the datagrid...the addition of dates i have one it but i now need to be able to display it in the datagrid

Sonu Kapoor
July 16th, 2003, 04:14 AM
Try this in codebehind:


Dim ds As DataSet
ds = New DataSet()
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()
End Sub


Sonu