Formatting single row on DataGrid - Webform

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gary Paris

    #1

    Formatting single row on DataGrid - Webform

    I have a datagrid on my web form and I have populated it with the following
    code:

    Dim strConn As String
    Dim strSQL As String
    strConn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
    Source=D:\Test\ MyDatabase.MDB; "

    strSQL = "Select client, newstarttime, newendtime, ccode from
    EventTable WHERE client <> '' ORDER BY client"
    Dim cnn As New OleDbConnection (strConn)
    Dim cmd As New OleDbDataAdapte r(strSQL, strConn)

    Dim ds As New DataSet
    cmd.Fill(ds, "EventTable ")

    DataGrid1.DataS ource = ds
    DataGrid1.DataB ind()

    -----------------------------------------------
    Question: How can I format the newstarttime and the newendtime fields to
    just show time.

    in the table, they are defined as Date/Time fields.

    Thanks,

    Gary


  • johnb41

    #2
    Re: Formatting single row on DataGrid - Webform

    I haven't worked in web forms in quite a while, but I think i remember
    how this is done. I could be wrong, but I think you need to customize
    your datagrid.

    For example, create separate columns. In the simplest case, make a
    bunch of "BoundColum ns". BoundColumns have a property called
    "DataFormatStri ng". That's the property that you need to format your
    date.

    Look in your documentation on the syntax for DataFormatStrin g, and then
    refer to this link for the details:

    http://msdn.microsoft.com/library/de...matstrings.asp

    John

    Comment

    Working...