Subtract values in two textboxes in listview row
Sorry about that... I am using an ASP.NET listview that can have one or many rows. Here is the HTML that is generated for the listview itself. I want to be able to subtract the two INPUTS named txtAmount and txtPayAmt from one another so that I can message the customer if they are getting ready to pay on an account that already has a zero balance.
Thanks for any help you can provide.
<DIV style="Z-INDEX: 590" id=divBTUAccts>
<TABLE style="BORDER-BOTTOM: #cc9966 1px solid; BORDER-LEFT: #cc9966 1px solid; BACKGROUND-COLOR: white; WIDTH: 100%; FONT-FAMILY: Arial; FONT-SIZE: 9pt; BORDER-TOP: #cc9966 1px solid; BORDER-RIGHT: #cc9966 1px solid" cellSpacing=0 cellPadding=4>
<TBODY>
<TR class=AccountTableHeader>
<TH> </TH>
<TH>Account / Address </TH>
<TH>Due Date </TH>
<TH>Payment Amount </TH>
<TH>Recurring? </TH>
</TR>
<TR class=MainRowColor>
<TD><INPUT id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_ListView_Accounts_ctrl0_chkAccount CHECKED type=checkbox name=ctl00$ctl00$ContentPlaceHolderBody_BTUWeb$ContentPlaceHolder_CenterColumn$ListView_Accounts$ctrl0$chkAccount> </TD>
<TD><SPAN id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_ListView_Accounts_ctrl0_lblAcct>2116280</SPAN> - <SPAN id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_ListView_Accounts_ctrl0_lblAddr>16177 WOODLAKE DR</SPAN> </TD>
<TD style="TEXT-ALIGN: center"><SPAN id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_ListView_Accounts_ctrl0_lblDueDt>05/25/2011</SPAN> </TD>
<TD style="TEXT-ALIGN: right"><SPAN id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_ListView_Accounts_ctrl0_lblDollar>$</SPAN> <INPUT style="TEXT-ALIGN: right" id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_ListView_Accounts_ctrl0_txtAmount value=10.00 type=text name=ctl00$ctl00$ContentPlaceHolderBody_BTUWeb$ContentPlaceHolder_CenterColumn$ListView_Accounts$ctrl0$txtAmount {95919BE0-C436-4eab-8083-096E94826667}="10.00"> </TD>
<TD></TD>
<TD style="DISPLAY: none"><INPUT style="DISPLAY: none" id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_ListView_Accounts_ctrl0_txtAmtDue value=0 type=text name=ctl00$ctl00$ContentPlaceHolderBody_BTUWeb$ContentPlaceHolder_CenterColumn$ListView_Accounts$ctrl0$txtAmtDue {95919BE0-C436-4eab-8083-096E94826667}="0"> </TD>
</TR>
<TR class=AccountTableFooter>
<TD> </TD>
<TD> </TD>
<TD> </TD>
开发者_运维技巧 <TD style="TEXT-ALIGN: right"> </TD>
<TD> </TD>
</TR><!--End of ListView_Accounts-->
<TR class=AccountTablePager align=middle>
<TD colSpan=5><SPAN id=ctl00_ctl00_ContentPlaceHolderBody_BTUWeb_ContentPlaceHolder_CenterColumn_DataPager1><SPAN>1</SPAN> </SPAN> </TD>
</TR>
</TBODY>
</TABLE>
</DIV>
I am new to using jQuery and so I throw myself on the mercy of you developers out there for help on this problem. I need to iterate through one or many rows in a listview all the while subtracting the amount in one textbox in the row from another. I have been trying to figure this out for a day now with no luck. Please help!
You can use the find control method for the ListViewItem to find your controls. Cast the controls as a textbox then get the values.
However you may be better served by checking the Item on the ItemDatabound event to see if there is a zero balance then add a js onclick to the checkbox that if it is checked then hit them with the alert.
精彩评论