Template column and Javascript

  • Thread starter Sjaakie Helderhorst
  • Start date
S

Sjaakie Helderhorst

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!
 
S

Sjaakie Helderhorst

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!
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top