Can't generate onchange evengt code for datagrid form

C

chumley

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">
<asp:DataGrid 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 /
</FooterTemplate>

</asp:TemplateColumn>

</Columns>
</asp:DataGrid>
</form>

ThANKS IN advance for any help!
chumley
 

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,985
Messages
2,570,202
Members
46,777
Latest member
JosefinaAc

Latest Threads

Top