How to multiply the values of the first and second columns in a table and assign values to the third column

Source: Internet
Author: User

Because of the reasons for the need to do so, no nonsense, directly on the code, I use the GridView binding data, table is the same, because the GridView code compiled by the browser is the table. The following is the HTML code for the ASPX page:

<asp:gridview id= "gv_new" runat= "Server" autogeneratecolumns= "False" cssclass= "Tb_data"
Width= "100%" allowpaging= "True" pagesize= "emptydatatext=" did not find the relevant data! "Onpageindexchanging=" > "gv_new_pageindexchanging"
<Columns>
<asp:templatefield headertext= "Send Time" headerstyle-width= "15%" >
<ItemTemplate>
<div style= "Text-align:center;" >
<% #Eval ("Msg_date", "{0:yyyy-mm-dd HH:mm:dd}")%>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:templatefield headertext= "Send People" headerstyle-width= "80px" >
<ItemTemplate>
<div style= "text-align:center;" class= "Fsrs_num" >
<% #Eval ("Per_num")%>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:templatefield headertext= "Translated text message number" headerstyle-width= "10%" >
<ItemTemplate>
<div style= "text-align:center;" class= "Zsts_num" >
<% #Eval ("Msg_total")%>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:templatefield headertext= "Consumption sms Number" headerstyle-width= "10%" >
<ItemTemplate>
<div style= "text-align:center;" class= "Xiaofei" >
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:boundfield datafield= "Msg_num" headertext= "remaining text message number" headerstyle-width= "" ></asp:BoundField>
</Columns>
</asp:GridView>

The next step is the jquery code:

<script type= "Text/javascript" >
$ (function () {
$ ("#gv_new tr"). each (function () {
var FSRS = $ (this). Find (". Fsrs_num");
var Sdts = $ (this). Find (". Zsts_num");
$ (this). Find (". Xiaofei"). Text ((parseint (Fsrs.text ()) * parseint (Sdts.text ()));
});
});
</script>

Don't forget to quote jquery Kochhar, I didn't write it out here.

Summary: I was "fsrs_num" is the definition of the ID, and then the result is not, in the group asked, said the best with the class, not prone to error, the results are satisfactory, the results are as follows:

How to multiply the values of the first and second columns in a table and then assign values to the third column

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.