ass.aspx.cs 中用了对应ad.aspx页面中的TextBoxName控件
结果编译包错:add.aspx.cs(30,4): error CS0103: 当前上下文中不存在名称“TextBoxName” 具体代码 add.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls; using System.Configuration;
using System.Data.SqlClient;
using System.Web.Security;
namespace a{
public class add: System.Web.UI.Page
{
/// <summary>
/// 提交按钮单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, System.EventArgs e)
{ } protected void ButtonOK_Click(object sender, System.EventArgs e)
{
TextBoxName.Test="";
Response.Write ("<font color=red size=20>>0</font>");
}
} } add.aspx
<%@ Page Language="c#" Inherits="a.add" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CMD</title>
</head>
<form action="crm.aspx" id="form1" method="post" >
<table height="100%" width="100%">
<tr> <td>产品名称</td>
<td><asp:TextBox ID="TextBoxName" runat="server"></asp:TextBox></td> </tr>
<tr>
<td>产品数量</td>
<td><asp:TextBox ID="TextBoxNum" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Button ID="ButtonOK" runat="server" Text="提交" OnClick="ButtonOK_Click">
</asp:Button>
</td>
</tr>
</table>
</form>
</html>
请问错在哪里?
结果编译包错:add.aspx.cs(30,4): error CS0103: 当前上下文中不存在名称“TextBoxName” 具体代码 add.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls; using System.Configuration;
using System.Data.SqlClient;
using System.Web.Security;
namespace a{
public class add: System.Web.UI.Page
{
/// <summary>
/// 提交按钮单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, System.EventArgs e)
{ } protected void ButtonOK_Click(object sender, System.EventArgs e)
{
TextBoxName.Test="";
Response.Write ("<font color=red size=20>>0</font>");
}
} } add.aspx
<%@ Page Language="c#" Inherits="a.add" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CMD</title>
</head>
<form action="crm.aspx" id="form1" method="post" >
<table height="100%" width="100%">
<tr> <td>产品名称</td>
<td><asp:TextBox ID="TextBoxName" runat="server"></asp:TextBox></td> </tr>
<tr>
<td>产品数量</td>
<td><asp:TextBox ID="TextBoxNum" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Button ID="ButtonOK" runat="server" Text="提交" OnClick="ButtonOK_Click">
</asp:Button>
</td>
</tr>
</table>
</form>
</html>
请问错在哪里?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货