J
JAPHET
I am Trying to Format date in my Datagrid to SHORTDATE format with the
following codes,
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
Dim dt As DateTime
dt = e.Item.Cells(2).Text
e.Item.Cells(2).Text = dt.ToString("dd-mm-yyyy")
End Sub
but I get the error Message
Cast from string "Entry Date" to type 'Date' is not valid.
following codes,
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
Dim dt As DateTime
dt = e.Item.Cells(2).Text
e.Item.Cells(2).Text = dt.ToString("dd-mm-yyyy")
End Sub
but I get the error Message
Cast from string "Entry Date" to type 'Date' is not valid.