Formatting a TemplateColumn of a datagrid

Discussion in 'ASP .Net' started by dana lees, Sep 7, 2004.

  1. dana lees

    dana lees Guest

    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 lees, Sep 7, 2004
    #1
    1. Advertisements

  2. Dana,

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

    Eliyahu
     
    Eliyahu Goldin, Sep 7, 2004
    #2
    1. Advertisements

  3. dana lees

    dana lees Guest

    I'm talking about client-side javascript

     
    dana lees, Sep 7, 2004
    #3
  4. 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
     
    Eliyahu Goldin, Sep 7, 2004
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.