Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Template column and Javascript

Reply
Thread Tools

Template column and Javascript

 
 
Sjaakie Helderhorst
Guest
Posts: n/a
 
      08-16-2004
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!


 
Reply With Quote
 
 
 
 
Sjaakie Helderhorst
Guest
Posts: n/a
 
      08-16-2004
> 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!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting Column width of Template Column in Datagrid.. Charleees ASP .Net 2 06-20-2006 12:52 PM
DataGrid loses view state if first column is a template column. Ken Varn ASP .Net 1 08-19-2005 02:54 PM
Template column base on another column value Esperanza ASP .Net Datagrid Control 5 02-21-2005 04:02 PM
how to know if a datagrid column is a template column? Dexter ASP .Net 1 01-18-2005 01:45 PM
Bound Column or Template Column (w dAdapater?) in DataGrid Ravichandran Mahalingam ASP .Net Datagrid Control 0 01-09-2004 03:30 PM



Advertisments