如何使用JavaScript乘以文本框值? - c#

<asp:GridView ID="GVFeedType" runat="server" Style="margin-bottom: 6px" BorderColor="#BDBDBD"
    CssClass="center" Width="500px" AutoGenerateColumns="false">
    <EmptyDataTemplate>
        No Records found</EmptyDataTemplate>
    <Columns>
        <asp:BoundField HeaderText="SNo" DataField="SNo" ItemStyle-Width="50px" />
        <asp:BoundField HeaderText="Feed Type" DataField="FeedType" ItemStyle-Width="200px" />
        <asp:TemplateField HeaderText="Rate/Kg" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:TextBox ID="txtrate" runat="server" Width="100px" OnTextChanged="txtrate_TextChanged"
                    AutoPostBack="true" />
                <asp:RequiredFieldValidator ID="RFVrecdate1" runat="server" ControlToValidate="txtrate"
                    Display="None" ErrorMessage="Must Enter Rate" ValidationGroup="duereport"></asp:RequiredFieldValidator>

            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Rate/50 Kg" ItemStyle-Width="80px">
            <ItemTemplate>
                <asp:Label ID="lbl50kg" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

我尝试了这段代码。

protected void txtrate_TextChanged(object sender, EventArgs e)
{

    GridViewRow currentRow = (GridViewRow)(sender as TextBox).Parent.Parent;
    float rate = 0;
    float kgrate50 = 50;

    rate = Convert.ToSingle((sender as TextBox).Text.Trim());
    kgrate50 = rate * kgrate50;
    (currentRow.Cells[3].FindControl("lbl50kg") as Label).Text = kgrate50.ToString();
    GVFeedType.Rows[currentRow.RowIndex + 1].Cells[2].FindControl("txtrate").Focus();
}

此代码很好,选项卡不起作用...
我在网格视图控件中有一个文本框,当我输入2,3,4之类的值时。然后将其乘以50 ...并在标签控件中显示输出。我解决了..请帮助我..

c#参考方案

我将CSs类添加到文本框中

<asp:TextBox ID="txtrate" runat="server" CssClass="TextBoxToHandle" Width="100px" OnTextChanged="txtrate_TextChanged"
                    AutoPostBack="true" />

由于使用标签抛出焦点事件,您需要订阅它

$(function(){
  $(".TextBoxToHandle").focusout(function(){
    //Do your code here this would be element which you focus left
  });
})

将python scikit学习模型导出到pmml - python

我想将python scikit-learn模型导出到PMML。哪个python软件包最合适?我阅读了有关Augustus的内容,但是我无法使用scikit-learn模型找到任何示例。 python大神给出的解决方案 SkLearn2PMML是 JPMML-SkLearn命令行应用程序周围的薄包装。有关受支持的Scikit-Learn Estimator和…

提交表单后显示模式对话框 - php

提交下载文件后,我有一张表格。我要自动而不是自动下载文件..以显示模态对话框并显示下载链接。<form name="softwareform" id="softwareform" action="../downloadlink.php" method="POST" alig…

DataSourceTransactionManager和JndiObjectFactoryBean和JdbcTemplate的用途是什么? - java

以下的用途是什么:org.springframework.jdbc.core.JdbcTemplate org.springframework.jdbc.datasource.DataSourceTransactionManager org.springframework.jndi.JndiObjectFactoryBean <tx:annotatio…

页面加载而不是提交时发生struts验证 - java

请原谅我;我对Struts有点陌生。我遇到一个问题,即页面加载而不是我实际提交表单时发生了验证。我整天都在论坛上搜寻和搜寻,没有任何运气。我显然做错了一些事情,应该很容易确定,但是我还没有发现问题所在。这是我的struts.xml的片段:<action name="*Test" method="{1}" clas…

在php中单击按钮添加表行并设置字段值 - javascript

我有一个表单,必须在单击按钮时添加表行。这是我必须动态添加的表行:(addProdToGroup.php)<tr style="text-align: center;" id="products"> <td><?php $j ?></td> <td><s…