CS0103: 当前上下文中不存在名称

注意变量声明的位置:

public partial class bizshow : System.Web.UI.Page
{
   
    public static string sf_content;

 protected void Page_Load(object sender, EventArgs e)

注意变量声明的位置:

public partial class bizshow : System.Web.UI.Page
{
   
    public static string sf_content;

 protected void Page_Load(object sender, EventArgs e)
    {

}

如果声明在Page_Load中的函数里

然后在页面用<%=%>调用就出错了.

声明在Page_Load中的可以用控件来赋值调用.

Leave a Reply

Your email address will not be published. Required fields are marked *