473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Separate code file

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
Feb 19 '07 #1
5 1296
On Feb 19, 4:54 am, "John" <J...@nospam.infovis.co.ukwrote:
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"
%>

Feb 19 '07 #2
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" <al************@gmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
On Feb 19, 4:54 am, "John" <J...@nospam.infovis.co.ukwrote:
>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"
%>

Feb 19 '07 #3
On Feb 19, 3:56 pm, "John" <J...@nospam.infovis.co.ukwrote:
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?

Feb 19 '07 #4
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" <al************@gmail.comwrote in message
news:11*********************@l53g2000cwa.googlegro ups.com...
On Feb 19, 3:56 pm, "John" <J...@nospam.infovis.co.ukwrote:
>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?

Feb 19 '07 #5
On Feb 19, 5:25 pm, "John" <J...@nospam.infovis.co.ukwrote:
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.

Feb 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Slavo Smutny | last post by:
Hi, which is better approach to store my JavaScript code, to store it in separate .js file or to embed the code within HTML attributes (e.g. <p onclick="javascript:submit();">click this</p>)? I...
4
by: Michael | last post by:
Hi When I New a web site, the default coding model is code-separation. I can uncheck the "place code in separate file" checkbox when I add a new WebForm, and VS2005 will remember this setting. ...
3
by: LurfysMa | last post by:
I would like to hear opinions on the tradeoffs of putting the tables, forms, and queries for several related datasets in separate databases vs one combined database. I am working on an...
2
by: farhad13841384 | last post by:
Hi , I Hope You fine. I have some problem with this code for paging in asp.net this bottom code work correctly without any error but when I try to place separate code in .VB file then error is...
4
by: Larry Epn | last post by:
Simple question: I have a c# asp.net project that was given to me. It has the c# code within the <scriptsection of the global.asax file. I would rather have it in separate files; e.g.,...
4
by: John Goche | last post by:
Hello, I have been going through several header source files which define classes with inline functions. In the case where the inline functions are not defined in place, the inline functions...
1
by: Lee | last post by:
Hi, I've converted my VS2003 project to a VS2005 web application project. The reason is to support AJAX. I want to create a new form and am following a microsoft tutorial. The problem is that...
0
by: vinnie | last post by:
I'm learning how to build web application with asp.net 2.0, and while the author of the book clearly invite the reader to place the code in a separate file if building a web form, he place the code...
1
by: vinnie | last post by:
I'm learning how to build web application with asp.net 2.0, and while the author of the book clearly invite the reader to place the code in a separate file if building a web form, he place the code...
2
by: tshad | last post by:
I just started using asp.net 2.0 and the book I am looking at shows that you now have the option to pub your code in separate files (not the default) as it was in 2003. I want to put the code in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.