Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Can't generate onchange evengt code for datagrid form

Reply
Thread Tools

Can't generate onchange evengt code for datagrid form

 
 
chumley
Guest
Posts: n/a
 
      01-15-2010
I'm having trouble generating onchange event code for a simple order
form housed in a datagrid.
This takes product items from sql database, whereas user can enter
quantity (originally set to 25) of cards they want to order (the
textbox id is txtQty). if they order 50 (so if they order 25 to 49,
the price would stay the same for the lot), the subtotal for that
given product will change another 15 dollars greater., so the formula
for the price wouldnt be product * price, but "if qty = qty + 25 then
subtotal = price + 15". Then the button click event would add the
subtotals to a grand total.
I cannot coordinate the adequate javascript that would fit with this
type of scenario, given that this is all predicated on each product
coming from the database;i'm wondering if there is another good source
i can be directed to that would show helper functions in the code
behind or header subs to calculate the onchange (or textOnchange)
event of the textbox.

<form name="mydgrid" runat="server">
<aspataGrid id="dgProducts" runat="server"
AutoGenerateColumns="False" CellPadding="4"
HeaderStyle-BackColor="teal"
HeaderStyle-ForeColor="White"
HeaderStyle-HorizontalAlign="Center"
Font-Name="Trebuchet MS"
HeaderStyle-Font-Bold="True"
ShowFooter="true"
ShowHeader="true"

>


<Columns>
<asp:BoundColumn HeaderText="ID" DataField="pID" />
<asp:BoundColumn HeaderText="Name" DataField="proname" />

<asp:TemplateColumn HeaderText="QTY"><ItemStyle
BackColor=GhostWhite />

<ItemTemplate>

<asp:TextBox ID="txtQty" name="txtQty"
runat="server" size="5px" Text='25' onChange="qtycg(this.form)">

</asp:TextBox>

</ItemTemplate>

</asp:TemplateColumn>

<asp:BoundColumn HeaderText="Price<br>1 Ink</br>"
DataField="UnitPrice"
ItemStyle-HorizontalAlign="Right"
DataFormatString="{0:$#,###.##}" />
<asp:BoundColumn HeaderText="Price<br>2 Ink</br>"
DataField="UnitPrice2C"
ItemStyle-HorizontalAlign="Right"
DataFormatString="{0:$#,###.##}" />


<asp:TemplateColumn HeaderText="Subtotal">
<ItemTemplate >
<asp:TextBox id="SubTotal" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "UnitPrice")%>'></asp:TextBox>

</ItemTemplate>
<FooterTemplate> <asp:Label id="lblGrandTotal" Runat="server"
Text='Grand Total:'></asp:Label> <br></br>
<asp:TextBox ID="Total" Runat="server"
size="5px" onFocus="this.form.elements[0].focus()"></asp:TextBox>
<br><asp:Button id=btnSave align=center CommandName="Save" Text=Save
runat=server />
<asp:Button ID="btnReset" align=center Text=Reset runat=server /
></br>

</FooterTemplate>

</asp:TemplateColumn>

</Columns>
</aspataGrid>
</form>

ThANKS IN advance for any help!
chumley
 
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
Form onchange command not working in FireFox v3 IcemanUK ASP .Net 0 09-01-2008 12:30 PM
Hot Swap using Onchange Form Noah Javascript 1 04-12-2004 02:36 PM
How to generate datagrid without knowing # of rows (not retrieving form a database) Hai Nguyen ASP .Net Datagrid Control 5 01-16-2004 04:05 PM
onChange problem with two dropdowns and one form Phil Powell Javascript 2 09-25-2003 08:34 AM
POSTING A FORM USING onchange Brendan Vogt ASP .Net 2 08-28-2003 02:09 PM



Advertisments