Formatting a TemplateColumn of a datagrid

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
 
E

Eliyahu Goldin

Dana,

Are you talking about server-side or client-side javascript?

Eliyahu
 
E

Eliyahu Goldin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,701
Latest member
XavierQ83

Latest Threads

Top