views:

76

answers:

2

Hi

i have some html like so:

    <tr>
        <td><%# Eval("Num") %></td>
        <td><%# Eval("myDate") %></td>
    </tr>
</table>

How can I apply formatting to the first value like:
DataFormatString="{0:f4}
and to the date like:
DataFormatString="{0:dd MMM yyyy}

I usually use a dataGrid where I can use the above properties in the BoundColumn section but i'm not sure how to use the same formatting when I try it as above

+4  A: 

You can include the formatting as a parameter of the Eval function:

<td><%# Eval("Num","{0:f4}") %></td>
<td><%# Eval("myDate","{0:dd MMM yyyy}") %></td>
Keltex
A: 

you could try

<td><%# ((DateTime)Eval("myDate")).ToString("{0:dd MMM yyyy}") %></td>
zonkflut