当前位置:编程学习 > C#/ASP.NET >>

出现 “WebApplication15._Default”不包含“结果”的定义,并且找不到可接受类型为“WebApplication15._Default

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication15
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int nu1 = int.Parse(this.num1.Text.ToString());
            int nu2 = int.Parse(this.num2.Text.ToString());
            int sum = 0;
            string n = this.dropdownlist.SelectedItem.Text.ToString();

            switch (n)
            {
                case ("+"):
                    sum = nu1 + nu2;
                    break;
                case "-":
                    sum = nu1 - nu2;
                    break;
                case "*":
                    sum = nu1 * nu2;
                    break;
                case "/":
                    sum = nu1 / nu2;
                    break;

            }
            this.结果.Text = sum.ToString();
           
           
           }

    }
} --------------------编程问答-------------------- 你的aspx里面有id=结果 的服务器控件么?
另外,最好换成英文字符串作为id的名称 --------------------编程问答--------------------
用英文命名 控件吧 
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,