cs文件中
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace WebApplication3
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1));
            this.TextBox2.Attributes.Add("onchange", "itemResult();");            //this.TextBox1.Attributes.Add("ondblclick", "popweb()");
        }        #region GetItemList
        [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
        public DataSet GetItemList(string item)
        {
            DataSet ds = new DataSet();
            ds.Tables.Add();
            ds.Tables[0].Columns.Add("name", typeof(string));            ds.Tables[0].Rows.Add("a12345");
            ds.Tables[0].Rows.Add("a12346");
            ds.Tables[0].Rows.Add("a22347");
            ds.Tables[0].Rows.Add("b12345");
            ds.Tables[0].Rows.Add("b22345");
            return ds;
        }
        #endregion
    }
}
aspx文件中
 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <title></title>
    <script language="javascript" type="text/javascript">
        function popweb() {
            //window.open("webForm2.aspx","newweb","height=500,width=800");
            window.open("webForm2.aspx");
        }        function itemResult() {
            var item = document.getElementById("TextBox2").value;
            alert(item);
            WebForm1.GetItemList(item, get_item_Result_CallBack);
        }        function get_item_Result_CallBack(response) {
            if (response.value != null) {
                var ds = response.value;                if (ds != null && typeof (ds) == "object" && ds.Tables != null) {
                    if (ds.Tables[0].Rows.length > 0) {
                        document.getElementById("ddlItem").style.display = "Item";
                        document.getElementById("ddlItem").length = 0;
                    }                    for (var i = 0; i < ds.Tables[0].Rows.length; i++) {
                        var name = ds.Tables[0].Rows[i].item;
                        document.getElementById("ddlItem").options.add(new Option(name));
                    }
                }
            }
            else {
                document.getElementById("ddlItem").style.display = "none";
            }
            return
        }    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <br />
            <br />
            <br />
            <asp:Button ID="Button1" runat="server" Text="Button" />
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <span style="position: absolute; border-left: yellowgreen 1px solid; border-top: yellowgreen 1px solid; border-right: yellowgreen 1px solid">
                <asp:ListBox Style="display: none" ID="ddlItem" runat="server" CssClass="formBaseFont" Width="200px"
                    Rows="5"></asp:ListBox></span>
        </div>
    </form>
</body>
</html>
运行的时候提示
错误: “WebForm1”未定义
自己写的一个非常非常简单的画面,但就是怎么也解决不聊,
目的就是在textbox2中输入“a",自动将a开头的记录匹配出来,各位可以新建一个webform的程序,将代码拷贝过去就可以运行了,请教各位大神该怎么解决啊,谢谢,万分感激!!