Reputation: 400
My newTransport.aspx button control
<asp:Button ID="najitRidiceButton" runat="server" Text="Vyhledat ridice" onclick="najitRidiceButton_Click" />
My newTransport.aspx.cs method
protected void najitRidiceButton_Click(object sender, EventArgs e)
{
DAODriver.searchDrivers(Calendar1.SelectedDate, casPrepravyTextBox.Text, Int32.Parse(pocetOsobTextBox.Text), extraZavazadla());
}
Error i get
CS1061: ASP.newtransport_aspx does not contain a definition for najitRidiceButton_Click and no extension method najitRidiceButton_Click accepting a first argument of type ASP.newtransport_aspx could be found (are you missing a using directive or an assembly reference?)
when i delete that button, everything works correctly, so i don´t understand it, this is my first ASP.NET web app so please help me i have no idea why it doesn´t work, although i tried to google it or find answer here on stackoverflow - no result
<%@ Page Title="" Language="C#" MasterPageFile="~/PageTemplate.Master"
AutoEventWireup="true" CodeBehind="NewTransport.aspx.cs"
Inherits="ASPDU1.NewTransport" %>
Upvotes: 1
Views: 22188
Reputation: 13
you seem to be using the ASP.NET WebApplication (i.e., not the ASP.NET WebSite) project type. If so, it is necessary to:
Upvotes: 1
Reputation: 515
I have had great success with changing build configuration (e.g. from debug to release), run the project, and then change back to the previous build configuration.
Upvotes: 1
Reputation: 50728
Try by making the event handler public void
instead of protected
, just to see. It works for me as protected void
, but there maybe something here that I can't figure out from this sample. I assume that the code-behind is pointed to the correct page in the ASPX markup's @Page
reference.
Upvotes: 5