views:

23

answers:

2

i have sql that uses FOR XM RAW to generate xml for my asp.net application to use to bind grids to and things like this.

the problem is that the date data is not taking the gridView formatting of the date because (and im taking a crack at this) the date value in the xml is a string and the formatting is not taking.

any thoughts on how to get this to work?

i like using xml because i can persists it to a log table and trace all the xml sent in and out. i would hate to loose this...

+1  A: 

You can use code on the RowDataBound event to reformat programatically. Here is a try in VB.

   Private Sub gvXML_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvXML.RowDataBound
        If (e.Row.RowType = DataControlRowType.DataRow) Then
            if IsDate(e.Row.Cells(1).Text) then
                e.Row.Cells(1).Text = CDate(e.Row.Cells(1).Text).Format("LongDate")
            End If
        End If
    End Sub

P.S. this is quickly modified from something else I am doing. It is not tested.

Bill
A: 

this is a heavy solution that doesn't make sense for formatting. actually i found using linq to xml was able to take care of things as needed...

kacalapy