点在计算器ASP中不起作用

时间:2016-06-05 16:04:52

标签: asp.net

我需要为学校制作ASP计算器。但问题在于。输出无效

这是我的代码:

protected void btn17_Click(object sender, EventArgs e)
    {
        if(txtScherm.Text.Contains(",") != true)
        {
            if(txtScherm.Text.Length == 0)
            {
                txtScherm.Text += "0,";
            }
            else
            {
                txtScherm.Text += ",";
            }
        }
    }

<asp:Table ID="Table3" runat="server" Width="274px">
                <asp:TableRow>
                    <asp:TableCell><asp:Button ID="btn16" runat="server" Text="0" Height="50" Width="100" OnClick="btn16_Click"/></asp:TableCell>
                    <asp:TableCell><asp:Button ID="btn17" runat="server" Text="." Height="50" Width="50" /></asp:TableCell>
                    <asp:TableCell><asp:Button ID="btn18" runat="server" Text="=" Height="50" Width="50" /></asp:TableCell>
                    <asp:TableCell><asp:Button ID="btn19" runat="server" Text="O2" Height="50" Width="50" /></asp:TableCell>
                </asp:TableRow>
            </asp:Table>

1 个答案:

答案 0 :(得分:0)

似乎缺少OnClick上的btn17属性:

<asp:Button ID="btn17" runat="server" Text="." OnClick="btn17_Click" ... />