Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 450489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:52:26+00:00 2026-05-12T21:52:26+00:00

I have the following button on a .aspx page: <asp:Button runat=server ID=bntLogin OnClick=bntLogin_Click Text=Login

  • 0

I have the following button on a .aspx page:

<asp:Button runat="server" ID="bntLogin" OnClick="bntLogin_Click" Text="Login" />

With the following in the .aspx.cs:

protected void bntLogin_Click(object sender, EventArgs e)
        {
           //
        }

When I try to build it I get the following error:

‘ASP.reserve_aspx’ does not contain a definition for ‘bntLogin_Click’ and no extension method ‘bntLogin_Click’ accepting a first argument of type ‘ASP.reserve_aspx’ could be found (are you missing a using directive or an assembly reference?)

However, when I move the click event from the code-behind to a script block inside the markup it builds.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:52:27+00:00Added an answer on May 12, 2026 at 9:52 pm

    Are you sure that you placed the method in the correct code-behind file?

    Check which file you are using as your code-behind file by looking at the @page directive at the top of the aspx file itself (check the inherits attribute) – you may be surprised.


    A loosely-related side note: By setting the OnClick with a string value that corresponds to the method you wish to invoke you are implicitly relying on ASP.NET’s AutoEventWireup feature which I don’t consider to be a good approach. It is better to manually wire up your controls in your page’s OnInit override method like this:

    bntLogin.Click += bntLogin_Click;
    

    By relying on AutoEventWireup you are allowing the ASP.NET runtime to create this code for you and since this happens at execution time you are incurring an execution time performance penalty as well as risking an exception like the one you are seeing now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in my aspx page: <asp:Button runat=server ID=myButton Text=hello />
I have the following: <EditItemTemplate> <asp:Button ID=wrqst_need_ind_btn runat=server Text = Create WR onClientClick=javascript:popUp('popup_createWR.aspx') CommandArgument='<%#
I have the following button: <Club:RolloverButton runat=server ValidationGroup=Login1 Text=Login ID=LoginButton CommandName=Login CssClass=links /> .links
I have the following multiview set up in my aspx page: <asp:MultiView id=MultiView1 runat=server
I have the following test ASPX page: <head runat=server> <title></title> <script src=js/jquery-1.2.6.min.js type=text/javascript></script> <script
I have the following control on my ASPX page: <asp:TextBox ID=txtISBN13 runat=server ClientIDMode=Static />
I have the following listbox on aspx page. <asp:ListBox runat=server ID=lbA Visible=true SelectionMode=Multiple DataTextField=A_FACTOR
I have the following button <asp:ImageButton ID=button1 runat=server ImageUrl=~/image.jpg CommandName = id CommandArgument =
I have following aspx page called search.aspx: <div id=wrap> <div id=menu> <div id=t_menus runat=server>
I have the following ASPX page: <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title></title> <script src=js/jquery-1.2.6.min.js

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.