Formatting a TemplateColumn of a datagrid

  • Thread starter Thread starter dana lees
  • Start date Start date
D

dana lees

Hello,

I am using a datagrid in which one of the columns is a TemplateColumn that
shows a date. I want to format this date to the appropriate date according
to the client's timezone.
For that, i have to call a javascript function which uses
"getTimezoneOffset" function to calculate the client's date and time.

This is the part of the code where i need to format the data:

<asp:TemplateColumn HeaderText="Received">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container,
Item.Received") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

Is it possible to call a javascript function when building the table?

Thanks,
Dana
 
Dana,

Obviously you can't call a client-side function while building the table on
the server.

Are all the records in the grid are going to have the same timezone, you can
get the client to send the timezone value to the server in the query string
or in the hidden field. Then the server can use it during response page
building.

Eliyahu
 
Back
Top