Button1_Click method doesn't exist

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bali

    Button1_Click method doesn't exist

    Hi

    I have an ascx control through which I am calling an aspx page using
    the following command.

    Page.ClientScri pt.RegisterStar tupScript(GetTy pe(), "test",
    "window.open(.. .)");

    Initially I just added a label controls on the page and it opened up
    fine without any errors.

    I then have added a button to the aspx page. When I double click on
    the button in design mode, I am transferred to the codebehind class to
    the button click event handler ( protected void Button1_Click(o bject
    sender, EventArgs e){}).

    Now when I run the application and get to the point where the ascx is
    calling the aspx page I get an error saying that there doesn't exist a
    Button1_Click method. I have checked the code behind and the method
    exists there, I can get to the method by double clicking in design
    mode and I have already tried removing and readding the button and
    that didn't work either. I can't figure out what the issue is here and
    any help regarding this would be greatly appreciated.

    Thanks

    Sumeet

  • Alexey Smirnov

    #2
    Re: Button1_Click method doesn't exist

    On Oct 19, 12:04 pm, Bali <sumeetkb...@gm ail.comwrote:
    Hi
    >
    I have an ascx control through which I am calling an aspx page using
    the following command.
    >
    Page.ClientScri pt.RegisterStar tupScript(GetTy pe(), "test",
    "window.open(.. .)");
    >
    Initially I just added a label controls on the page and it opened up
    fine without any errors.
    >
    I then have added a button to the aspx page. When I double click on
    the button in design mode, I am transferred to the codebehind class to
    the button click event handler ( protected void Button1_Click(o bject
    sender, EventArgs e){}).
    >
    Now when I run the application and get to the point where the ascx is
    calling the aspx page I get an error saying that there doesn't exist a
    Button1_Click method. I have checked the code behind and the method
    exists there, I can get to the method by double clicking in design
    mode and I have already tried removing and readding the button and
    that didn't work either. I can't figure out what the issue is here and
    any help regarding this would be greatly appreciated.
    >
    Thanks
    >
    Sumeet
    Does aspx work when you call it directly as http://.../page.aspx?

    Comment

    • Bali

      #3
      Re: Button1_Click method doesn't exist

      On Oct 19, 7:03 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
      On Oct 19, 12:04 pm, Bali <sumeetkb...@gm ail.comwrote:
      >
      >
      >
      >
      >
      Hi
      >
      I have an ascx control through which I am calling an aspx page using
      the following command.
      >
      Page.ClientScri pt.RegisterStar tupScript(GetTy pe(), "test",
      "window.open(.. .)");
      >
      Initially I just added a label controls on the page and it opened up
      fine without any errors.
      >
      I then have added a button to the aspx page. When I double click on
      the button in design mode, I am transferred to the codebehind class to
      the button click event handler ( protected void Button1_Click(o bject
      sender, EventArgs e){}).
      >
      Now when I run the application and get to the point where the ascx is
      calling the aspx page I get an error saying that there doesn't exist a
      Button1_Click method. I have checked the code behind and the method
      exists there, I can get to the method by double clicking in design
      mode and I have already tried removing and readding the button and
      that didn't work either. I can't figure out what the issue is here and
      any help regarding this would be greatly appreciated.
      >
      Thanks
      >
      Sumeet
      >
      Does aspx work when you call it directly ashttp://.../page.aspx?- Hide quoted text -
      >
      - Show quoted text -
      Apparently not. If I type http://localhost/..../webform2.aspx in IE, I
      get the same error.

      Compilation error.

      Description: An error occured during the compilation of a resource
      required to service the request....

      Compiler Error Message: ...webform2_asp x does not contain a definition
      for 'Button1_Click'

      and if I open up the solution in VS2005 and set webform2 as the
      startup page and run it, the page opens up fine and the button click
      event works as well.

      Any ideas?

      Thanks for looking into this.

      Sumeet

      Comment

      • Alexey Smirnov

        #4
        Re: Button1_Click method doesn't exist

        On Oct 19, 9:04 pm, Bali <sumeetkb...@gm ail.comwrote:
        Apparently not. If I typehttp://localhost/..../webform2.aspxin IE, I
        get the same error.
        >
        ok, it means it doesn't matter from where you call it

        How did you create the webform? Maybe you did change the namespace or
        a name of the class? Check if Namespace.Class from <%@ Page
        Inherits="Names pace.Class" is the same as in the code behind. Check if
        the AutoEventWireup attribute of the Page directive is set to true (if
        it is missing by default it is true). If you see nothing wrong, try to
        rename the webform2.aspx to webform2_.aspx and create new
        webform2.aspx.

        Comment

        • Bali

          #5
          Re: Button1_Click method doesn't exist

          On Oct 19, 2:27 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
          On Oct 19, 9:04 pm, Bali <sumeetkb...@gm ail.comwrote:
          >
          Apparently not. If I typehttp://localhost/..../webform2.aspxin IE, I
          get the same error.
          >
          ok, it means it doesn't matter from where you call it
          >
          How did you create the webform? Maybe you did change the namespace or
          a name of the class? Check if Namespace.Class from <%@ Page
          Inherits="Names pace.Class" is the same as in the code behind. Check if
          the AutoEventWireup attribute of the Page directive is set to true (if
          it is missing by default it is true). If you see nothing wrong, try to
          rename the webform2.aspx to webform2_.aspx and create new
          webform2.aspx.
          Hi

          I tried all of the above and still none worked! Any other things that
          you can think of coz I am surely running out of ideas.

          Thanks

          Sumeet

          Comment

          Working...