OK, I'm about to pull my hair out with this one. I know it's simple, but I can't find a way to do this other than switching it to a string and parsing it out manually (something I should have to be forced to do).

I've got a simple MySQL Table with a DateTime field in it. I want to display it as separate fields in a DataGrid, so I've got a column like this in there:

  <asp:TemplateColumn>
     <HeaderTemplate><b>Date</b></HeaderTemplate>
     <ItemTemplate>
        <%# Container.DataItem("StartDateTime") %>
     </ItemTemplate>
  </asp:TemplateColumn>

It displays a blank.

Also, I've got code where the user clicks an Edit link and it brings up the date and time part separately. When I try to run the following code:

  StartDate.Text = FormatDateTime(RS("StartDateTime"),2)
  StartTime.Text = FormatDateTime(RS("StartDateTime"),3)

I get the error, "Cast from type 'MySqlDateTime' to type 'Date' is not valid.". I change change the above code to this:

  StartDate.Text = FormatDateTime(RS("StartDateTime").ToString,2)
  StartTime.Text = FormatDateTime(RS("StartDateTime").ToString,3)

and it works... However, what can I do with the DataGrid column above?

Thanks,
Jesse

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to