Template column and Javascript

Discussion in 'ASP .Net Datagrid Control' started by Sjaakie Helderhorst, Aug 16, 2004.

  1. Hello all,
    I'm having some problems with data in a template column.
    The column...

    <asp:TemplateColumn HeaderText="Amount">
    <HeaderStyle Width="75px"></HeaderStyle>
    <ItemStyle Font-Size="10px" HorizontalAlign="Left"
    BackColor="White"></ItemStyle>
    <ItemTemplate>
    <asp:TextBox ID="txtAmount" BorderStyle="Solid" Width="40"
    TextMode="SingleLine"
    Runat="server" MaxLength="5" Text='<%# DataBinder.Eval(Container.DataItem,
    "Amount") %>'
    Font-Size="11px" onKeyUp='checkNumericInput(this); setAmountTotal(this,
    <%# DataBinder.Eval(Container.DataItem, "NumberOfItemsInPackage") %>);'
    onKeyDown="checkCursorKeyPress(this);" onFocus="setCurrentAmount(this);"
    onBlur="updateCurrentAmount(this)" />
    x <%# DataBinder.Eval(Container.DataItem, "Inhoud") %>
    </ItemTemplate>
    </asp:TemplateColumn>

    On onKeyUp 2 Javascripts are triggered which check if value is numeric and
    calculates total of input value times the number of items in package.

    Problem occur with: setAmountTotal(this, <%#
    DataBinder.Eval(Container.DataItem, "NumberOfItemsInPackage") %>);'
    Somehow onKeyUp='checkNumericInput(this); setAmountTotal(this, <%#
    DataBinder.Eval(Container.DataItem, "NumberOfItemsInPackage") %>);'
    isn't parsed to a value. The source-code of the rendered page looks like:
    onKeyUp="checkNumericInput(this); setOrderTotal(this, <%#
    DataBinder.Eval(Container.DataItem, &quot;Inhoud&quot;) %>);"

    Can anyone explain why this is happening?

    Thanks!
    Sjaakie Helderhorst, Aug 16, 2004
    #1
    1. Advertising

  2. > Problem occurs with: setAmountTotal(this, <%#
    > DataBinder.Eval(Container.DataItem, "NumberOfItemsInPackage") %>);'
    > Somehow onKeyUp='checkNumericInput(this); setAmountTotal(this, <%#
    > DataBinder.Eval(Container.DataItem, "NumberOfItemsInPackage") %>);'
    > isn't parsed to a value. The source-code of the rendered page looks like:
    > onKeyUp="checkNumericInput(this); setOrderTotal(this, <%#
    > DataBinder.Eval(Container.DataItem, &quot;Inhoud&quot;) %>);"
    >


    I solved it by having the code-behind fill an <asp:label> with a javascript
    array containing the NumberOfItemsInPackage-value per record.

    Thanks anyway!
    Sjaakie Helderhorst, Aug 16, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dexter
    Replies:
    1
    Views:
    418
    Eliyahu Goldin
    Jan 18, 2005
  2. Ken Varn
    Replies:
    1
    Views:
    975
    Ken Varn
    Aug 19, 2005
  3. Charleees
    Replies:
    2
    Views:
    8,207
    Eliyahu Goldin
    Jun 20, 2006
  4. Ravichandran Mahalingam

    Bound Column or Template Column (w dAdapater?) in DataGrid

    Ravichandran Mahalingam, Jan 9, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    220
    Ravichandran Mahalingam
    Jan 9, 2004
  5. Esperanza

    Template column base on another column value

    Esperanza, Feb 18, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    175
    Elton Wang
    Feb 21, 2005
Loading...

Share This Page