CS1061 :(您是否缺少using指令或程序集引用?

时间:2014-12-26 10:08:13

标签: c# asp.net web-project

我收到此错误

  

CS1061:'ASP.dashboard_aspx'不包含'Button6_Click'的定义,并且没有扩展方法'Button6_Click'可以找到类型'ASP.dashboard_aspx'的第一个参数(你是否缺少using指令或程序集)引用?)

当我在我的开发PC上运行它时工作正常,但是当我上传到服务器上时会出现此错误。

来源错误:

Line 252:
Line 253:                </td><td>
Line 254:<asp:Button ID="Button3" runat="server" BackColor="#FF9933"     ForeColor="White"   Height="30px" Text="Search" Width="129px" OnClick="Button3_Click" Visible="False" />
Line 255:                </td>
Line 256:            </tr>

我的CS档案:

<asp:Button ID="Button3" runat="server" BackColor="#FF9933" Font-Size="Large" ForeColor="White" Height="30px" OnClick="Button3_Click" Text="Search" Visible="False" Width="200px" />

代码背后:

protected void Button3_Click(object sender, EventArgs e)
    {
        conn = new SqlConnection(strcon);
        conn.Open();
        DataTable dt = new DataTable();
        cmd = new SqlCommand("select * from AssignedProject  where under=@Projectid", conn);
        cmd.Parameters.AddWithValue("@Projectid", DropDownList2.Text);
        da = new SqlDataAdapter(cmd);
        da.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            Label16.Text = "View FTEs Details";
            GridView5.Visible = true;
            GridView2.Visible = false;
            GridView5.DataSource = dt;
            GridView5.DataBind();

        }
        else
        {
            Label16.Text = " On Going Project";
            loadGV();
        }
        conn.Close();
    }

我试过: 1.清洁和重建 2.重新创建按钮和事件 3.研究过,他们说要在&lt; @Page添加Inherit标签已经存在。 似乎没有什么工作。它在前一天在服务器上运行时也会感到困惑。刚刚添加了这个按钮和下拉列表,从那时起就无法正常工作。

如果我遗失任何内容,请告诉我。 感谢

2 个答案:

答案 0 :(得分:1)

在第1061行。你有另一个按钮,Onclick =“Button6_Click”,受保护的空白'Button6_Click'从后面的代码中删除。

调试器没有必要指向确切的错误位置。

答案 1 :(得分:0)

最后不得不放弃,并重复一切。希望备份早期版本正在运行。所以,艰难地学到了一课。谢谢大家。

相关问题