'ASP.business_aspx' does not contain a definition for 'submitSearchClick' and no extension method 'submitSearchClick'
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' and no extension method 'submitSearchClick' accepting a first argument of type 'ASP.business_aspx' could be found
This is the code I have in the page 'business.aspx.cs'
protected void submitSearchClick(object sender, EventArgs e)
{
}
and this is the line that the error keeps pulling up...
<asp:Button ID="searchButton" text="Search" runat="server" onclick="submitSearchClick"/>
I am really confused at the moment, people have been telling me to change private to protected, but it is all ready protected, and I have searched the site for a viable answer but sadly, nothing has been found.
Solution 1:
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.