'ASP.business_aspx' does not contain a definition for 'submitSearchClick' and no extension method 'submitSearchClick'

前端 未结 2 1947
暗喜
暗喜 2020-12-02 00:58

I keep getting this error popping up every time I try to run a page on my website...

\'ASP.business_aspx\' does not contain a definition for \'submitSearchClick\' an

相关标签:
2条回答
  • 2020-12-02 01:38

    Is there a corresponding business.aspx.designer.cs file that is out of sync? Try changing a property on the control from within the designer. Need more information otherwise.

    0 讨论(0)
  • 2020-12-02 01:48

    Let the mark up generate the event handler itself. Back up your event handler contents. Delete the on click event handler in the code behind and its attribute in the markup. Retype the on click attribute in the mark up but this time choose the create a new event option from Visual studio Intellisense. This will create an event like this in the code behind.

    protected void submitSearch_Click(object sender, EventArgs e)
       {
    
    
       }
    

    This usually fixes a corrupt designer file.Clean and rebuild your solution and now the event will be wired to the button.

    Alternatively , delete the onclick attribute in the mark up and its handler in code behind.Then right click the button in the designer, and on the onclick event, on its properties(accessed by clicking the lightning icon), regenerate the event handler.

    0 讨论(0)
提交回复
热议问题