- A+
所属分类:.NET技术
话不多说 先上效果图:
功能:
1.每一个更新按钮对应着所更新的书籍定价数量,并将结果输出至消费总金额处
2.提交对应着所有书籍对应价格数量的总和,同样输出至总金额处
3.重置既刷新页面
实列:
1.整体是居中的,效果图存在位置偏差
2.数量和消费总金额的默认值是0,如果将0删除会出现报错,所以请小心
OK 上代码
.aspx
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace login { public partial class WebForm1 : System.Web.UI.Page { protected void num1(object sender, EventArgs e) { double str = Convert.ToDouble(TextBox.Text); double a = 49.00; TextBox4.Text = Convert.ToString(str * a); } protected void num2(object sender, EventArgs e) { double str1 = Convert.ToDouble(TextBox1.Text); double a = 49.00; TextBox4.Text = Convert.ToString(str1 * a); } protected void num3(object sender, EventArgs e) { double str2 = Convert.ToDouble(TextBox2.Text); double c = 53.00; TextBox4.Text = Convert.ToString(str2 * c); } protected void num4(object sender, EventArgs e) { double str3 = Convert.ToDouble(TextBox3.Text); double d = 45.00; TextBox4.Text = Convert.ToString(str3 * d); } protected void num(object sender, EventArgs e) { double str = Convert.ToDouble(TextBox.Text); double str1 = Convert.ToDouble(TextBox1.Text); double str2 = Convert.ToDouble(TextBox2.Text); double str3 = Convert.ToDouble(TextBox3.Text); double a = 49.00; double c = 53.00; double d = 45.00; TextBox4.Text = Convert.ToString(str3 * d+ str2 * c+ str1 * a+ str * a); } protected void f(object sender, EventArgs e) { Response.Redirect(Request.Url.ToString()); } protected void Page_Load(object sender, EventArgs e) { } } }
.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace login { public partial class WebForm1 : System.Web.UI.Page { protected void num1(object sender, EventArgs e) { double str = Convert.ToDouble(TextBox.Text); double a = 49.00; TextBox4.Text = Convert.ToString(str * a); } protected void num2(object sender, EventArgs e) { double str1 = Convert.ToDouble(TextBox1.Text); double a = 49.00; TextBox4.Text = Convert.ToString(str1 * a); } protected void num3(object sender, EventArgs e) { double str2 = Convert.ToDouble(TextBox2.Text); double c = 53.00; TextBox4.Text = Convert.ToString(str2 * c); } protected void num4(object sender, EventArgs e) { double str3 = Convert.ToDouble(TextBox3.Text); double d = 45.00; TextBox4.Text = Convert.ToString(str3 * d); } protected void num(object sender, EventArgs e) { double str = Convert.ToDouble(TextBox.Text); double str1 = Convert.ToDouble(TextBox1.Text); double str2 = Convert.ToDouble(TextBox2.Text); double str3 = Convert.ToDouble(TextBox3.Text); double a = 49.00; double c = 53.00; double d = 45.00; TextBox4.Text = Convert.ToString(str3 * d+ str2 * c+ str1 * a+ str * a); } protected void f(object sender, EventArgs e) { Response.Redirect(Request.Url.ToString()); } protected void Page_Load(object sender, EventArgs e) { } } }
其实还有更优的方法的
欢迎指点
其实加入购物车事件也写好的了 不过太烂了 就不出来丢人了
有没有人 说两句