Please help me..

When i code in my PC for this programming it is running without any error, but when i release it to server i Encountered error Compiler Error Message: CS1061: 'ASP. registration_aspx' does not contain a definition for 'btnDeactivate_Onclick' and no extension method 'btnDeactivate_Onclick' accepting a first argument of type 'ASP. registration_aspx' could be found (are you missing a using directive or an assembly reference?)

aspx code :

 <asp:GridView ID="gvData" runat="server" AllowPaging="true" PageSize="20" AutoGenerateColumns="false" 
                    PagerSettings-Visible="false" HeaderStyle-CssClass="GV_Header " RowStyle-CssClass="GV_Row" EnableModelValidation="True" 
                    Width="100%" OnSelectedIndexChanging="btnDeactivate_Onclick" OnRowCommand="gvData_RowCommand"  
                 DataKeyNames="rebate_code" >

 <asp:TemplateField HeaderText="">                    
                            <ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
                            <ItemTemplate>
                              <asp:ImageButton ImageUrl="~/Images/comm_img/disable.png" ID="Deactivate" runat="server" 
                               ToolTip="Deactivate" CommandName="Select"      
                               CommandArgument='<%# Eval("rebate_code") %>' />                               
                            </ItemTemplate>
                        </asp:TemplateField>

aspx.cs code :

 protected void btnDeactivate_Onclick(object sender, GridViewSelectEventArgs e)

    {
        //only fanliyee & chloe can deactivate the lump sum rebate
            if ((Session["LoginName"].ToString()) == "fanliyee" || (Session["LoginName"].ToString()) == "chloelimenghui")
            {
            string RebateCode = gvData.DataKeys[e.NewSelectedIndex].Value.ToString();
            GridViewRow row = (GridViewRow)gvData.Rows[e.NewSelectedIndex];
            int rowUpdate = 0;
            DataSet result = new DataSet();
            result = BO_Rebate.Deactivate_RebateLS_List(Session["LoginName"].ToString(), RebateCode);
            rowUpdate = Convert.ToInt32(result.Tables[0].Rows[0]["ReturnValue"]);
            if (rowUpdate != 0)
            {
                BindData();
                //gvData.EditIndex = -1;
                //gvData.DataBind();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Deactivated succesfully');", true);
                return;
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Deactivated failed !');", true);

                return;
            }
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('User is not eligible to perform this function !');", true);

            return;
        }
    }

Dani AI

Generated

As reported, replacing the Bin folder on the live server resolved the CS1061 error. In ASP.NET that error means the page markup referred to a member (an event handler, property or method) that the runtime could not find in the compiled assemblies it had loaded. Replacing the Bin typically fixes this when the server is running an out‑of‑date or missing DLL.

Short explanation: ASP.NET page markup (the .aspx) and the compiled code-behind are linked at runtime. If the Bin folder on the server does not contain the matching, up‑to‑date assembly, the runtime will not see the handler the markup expects and will raise CS1061. This often happens after partial/manual deployments, precompiled-site mismatches, or when old DLLs remain on the server.

Checklist to diagnose and prevent the problem:

  • Confirm the deployed Bin contains the latest project DLLs (check file timestamps/version).
  • Make sure the compiled DLL’s namespace/class matches the page Inherits attribute used by the markup.
  • Verify there are no duplicate or old assemblies in Bin or the GAC shadowing the new DLL.
  • Recycle the App Pool or restart IIS and clear the ASP.NET Temporary Files to force recompile.
  • Use a proper Publish/Web Deploy or CI/CD pipeline so the Bin is replaced atomically instead of manual copy.
  • For precompiled sites, ensure the publishing options (updatable vs non‑updatable) match the deployment approach.

Final note: the symptom and your fix strongly point to a build/deploy mismatch rather than a code bug. Replacing the Bin put the correct compiled code on the server so the event handler existed again. For long‑term stability, adopt a repeatable publish workflow so Bin is always synchronized with the markup.

This issue has been solved by replacing the Bin folder to the live server..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.