Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
I am getting this error

    CS1061:'ASP.dashboard_aspx' does not contain a definition for 'Button6_Click' and no extension method 'Button6_Click' accepting a first argument of type 'ASP.dashboard_aspx' could be found (are you missing a using directive or an assembly reference?)

When I run it on my development PC it works fine, however when I uploaded on the server it gives this error.

Source Error:

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>

My CS file

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

My code behind

<pre>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 &gt; 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();
    }</pre>


I have tried to : 1. Clean and Rebuild 2. Recreate the button and event 3. Researched and they said to add Inherit tag at <@Page its already there. Nothing seems to be working . It confuses as it was running a day before on the server too. Just added this button and dropdownlist since then its not working.

Please let me know If I am missing anything. Thanks
Posted
Comments
[no name] 31-Dec-14 1:17am    
I think you are having Button6 at somewhere in your code. Check for the same name in the designer class as well. Might be some control named as Button6 is not removed from the Designer class.

1 solution

Make sure that inherit attribute points to the correct class. It generally happens when you copied a page from an existing page in the same project.

From the source file, it is clear that there are no buttons with name you have asked in the question.

I am not sure but you may give a try by changing the inherits property slightly (may b by adding just a '_' character at the last) in both the design and code page.

In case this doesn't resolve your problem, please let me know.

Update
Try pasting below event in your code page

C#
protected void Button6_Click(object sender, EventArgs e)
{
   //no logic required here
}
 
Share this answer
 
v3
Comments
markwhite1 30-Dec-14 7:09am    
I havent tried that , however when i got to that buttons event from property window it takes me straight to C# code for that event. However , I saw my hosts traffic bandwidth Its limitation is 1GB and it says I have used 1.2GB so is there any way that might b creating an issue ?
markwhite1 31-Dec-14 0:34am    
@suvendu it didnt work out :-(
Suvendu Shekhar Giri 31-Dec-14 0:59am    
No, your bandwidth has nothing to do with this particular issue though.
Suvendu Shekhar Giri 31-Dec-14 1:03am    
I have updated the answer. Try once if it works. It is not the correct solution but just a workaround.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900