DisplayBox_TextChanged'没有定义

本文关键字:定义 TextChanged DisplayBox | 更新日期: 2023-09-27 18:03:23

Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
Compiler Error Message: CS1061: 'ASP.calculator_aspx' does not contain a definition for 'DisplayBox_TextChanged' and no extension method 'DisplayBox_TextChanged' accepting a first argument of type 'ASP.calculator_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:enter code here
Line 18:     <tr>
Line 19:         <td colspan="5">
Line 20:             <asp:TextBox ID="DisplayBox" runat="server" 
Line 21:                 ontextchanged="DisplayBox_TextChanged" Width="268px"></asp:TextBox>
Line 22:         </td>
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class calculator : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

DisplayBox_TextChanged'没有定义

如果你想支持DisplayBox的TextChanged事件,在。cs文件中实现DisplayBox_TextChanged事件。

protected void DisplayBox_TextChanged(object sender, EventArgs e)
{
    //logic...
}

如果您对TextChanged事件不感兴趣,那么从XAML文件中删除以下部分(第21行)。

ontextchanged="DisplayBox_TextChanged"

从您提供的一小段代码听起来,您试图响应ontextchanged事件,但您没有实现DisplayBox_TextChanged方法来处理该事件。要么从上面的代码中删除ontextchanged="DisplayBox_TextChanged,要么创建一个名为DisplayBox_TextChanged

的方法

在您的代码后面文件中,您需要实现DisplayBox_TextChanged方法。

它看起来像这样

protected void DisplayBox_TextChanged( EventArgs e )
{
    //code here
}

MSDN for methodhttp://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.ontextchanged (v =应用程序). aspx

试试这个:

从项目资源管理器右键单击项目,选择添加引用,添加dll文件StructureMap.dll它可能在项目的bin目录

http://forums.asp.net/t/1381741.aspx/1

JMax