Separate code file

J

John

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
 
G

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

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"
%>
 
J

John

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

Thanks

Regards
 
G

Guest

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?
 
J

John

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
 
G

Guest

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top