ASP.NET程序填空
Default.aspx中部分代码
<html xmlns="
http://www.w3.org/1999/xhtml">
<head runat="server">
<title> asp.net程序设计基础</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" Width="61px"></asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>+</asp:ListItem>
<asp:ListItem>-</asp:ListItem>
<asp:ListItem>*</asp:ListItem>
<asp:ListItem>/</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox2" runat="server" Width="57px"></asp:TextBox>
<asp:ButtonID="Button1" runat="server" onclick="Button1_Click" Text="计算" />
<br />
计算结果:<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
Default.aspx.cs部分代码
protected void Button1_Click(object sender, EventArgs e)
{
double A = (6) ;
double B = (7) ;
double (8) ;
switch (DropDownList1.SelectedValue)
{
case "+":
C = A + B;
break;
case "-":
C = A - B;
break;
case "*":
C = A * B;
break;
case "/":
(9) ;
break;
}
Label1.Text = (10) ;
}
}
该程序的最终运行效果如下图所示:
答案:6. Convert.ToDouble(TextBox1.Text)
7. Convert.ToDouble(TextBox2.Text)
8. C
9. C=A/B
10. C.ToString()
上一个:asp.net中点击图片进入下一张图片如何实现 有代码最好
下一个:那些 Web server 支持 ASP?