Separate code file

Discussion in 'ASP .Net' started by John, Feb 19, 2007.

  1. John

    John Guest

    Hi

    I have a button on a webform. When I double click the button to create click
    event it is created in the same file (aspx). How can I tell vs2005 to create
    the code in a separate aspx.vb file?

    Thanks

    Regards
     
    John, Feb 19, 2007
    #1
    1. Advertising

  2. On Feb 19, 4:54 am, "John" <> wrote:
    > Hi
    >
    > I have a button on a webform. When I double click the button to create click
    > event it is created in the same file (aspx). How can I tell vs2005 to create
    > the code in a separate aspx.vb file?
    >
    > Thanks
    >
    > Regards


    You enable the ASP .NET code-behind feature by adding attributes to
    the @Page directive.

    for VB

    <%@ Page Language="VB" Inherits="myClass" CodeBehind="myPage.aspx.vb"
    %>

    for C#

    <%@ Page Language="C#" Inherits="myClass" CodeBehind="myPage.aspx.cs"
    %>
     
    Alexey Smirnov, Feb 19, 2007
    #2
    1. Advertising

  3. John

    John Guest

    Does that mean that it is not something one should normally be doing
    otherwise it would have been provided by default?

    Thanks

    Regards

    "Alexey Smirnov" <> wrote in message
    news:...
    > On Feb 19, 4:54 am, "John" <> wrote:
    >> Hi
    >>
    >> I have a button on a webform. When I double click the button to create
    >> click
    >> event it is created in the same file (aspx). How can I tell vs2005 to
    >> create
    >> the code in a separate aspx.vb file?
    >>
    >> Thanks
    >>
    >> Regards

    >
    > You enable the ASP .NET code-behind feature by adding attributes to
    > the @Page directive.
    >
    > for VB
    >
    > <%@ Page Language="VB" Inherits="myClass" CodeBehind="myPage.aspx.vb"
    > %>
    >
    > for C#
    >
    > <%@ Page Language="C#" Inherits="myClass" CodeBehind="myPage.aspx.cs"
    > %>
    >
     
    John, Feb 19, 2007
    #3
  4. On Feb 19, 3:56 pm, "John" <> wrote:
    > Does that mean that it is not something one should normally be doing
    > otherwise it would have been provided by default?
    >


    VS creates that by default, when you add a new WebForm into project.
    How do you created it?
     
    Alexey Smirnov, Feb 19, 2007
    #4
  5. John

    John Guest

    Hi

    I suspect I copied from another predone webform. I have now added this line
    at the top;

    <%@ Page Language="VB" MasterPageFile="MyMaster.master"
    AutoEventWireup="false" CodeFile="MyPage.aspx.vb"
    Inherits="Events_Settings_MyPage" Title="My Title" %>

    and it says 'file '/Events/Settings/MyPage.aspx.vb' does not exist.' which
    of course is true as the page did not have code behind to start with. How
    can I now get vs to create the MyPage.aspx.vb file and link to the webform?

    Thanks

    Regards

    "Alexey Smirnov" <> wrote in message
    news:...
    > On Feb 19, 3:56 pm, "John" <> wrote:
    >> Does that mean that it is not something one should normally be doing
    >> otherwise it would have been provided by default?
    >>

    >
    > VS creates that by default, when you add a new WebForm into project.
    > How do you created it?
    >
     
    John, Feb 19, 2007
    #5
  6. On Feb 19, 5:25 pm, "John" <> wrote:
    > Hi
    >
    > I suspect I copied from another predone webform. I have now added this line
    > at the top;
    >


    Well, I think the best way is to add a new webform to your project. VS
    will create aspx and the one for code-behind. Then you can copy your
    code to this new webform, or use created code-behind *.vb as an
    example.
     
    Alexey Smirnov, Feb 19, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pavan Apuroop

    Code behind file in separate folder

    Pavan Apuroop, Jun 24, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,974
    Juan T. Llibre
    Jun 24, 2005
  2. Michael
    Replies:
    4
    Views:
    3,866
    Michael
    Dec 27, 2005
  3. EvgueniB
    Replies:
    1
    Views:
    655
    Anthony Borla
    Dec 15, 2003
  4. Frank Fredstone
    Replies:
    1
    Views:
    460
    Jean-Francois Briere
    Jun 27, 2006
  5. Nikos
    Replies:
    4
    Views:
    172
    Nikos
    May 7, 2007
Loading...

Share This Page