Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Separate code file

Reply
Thread Tools

Separate code file

 
 
John
Guest
Posts: n/a
 
      02-19-2007
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


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-19-2007
On Feb 19, 4:54 am, "John" <J...@nospam.infovis.co.uk> 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"
%>

 
Reply With Quote
 
 
 
 
John
Guest
Posts: n/a
 
      02-19-2007
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: oups.com...
> On Feb 19, 4:54 am, "John" <J...@nospam.infovis.co.uk> 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"
> %>
>



 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-19-2007
On Feb 19, 3:56 pm, "John" <J...@nospam.infovis.co.uk> 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?

 
Reply With Quote
 
John
Guest
Posts: n/a
 
      02-19-2007
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: ups.com...
> On Feb 19, 3:56 pm, "John" <J...@nospam.infovis.co.uk> 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?
>



 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-19-2007
On Feb 19, 5:25 pm, "John" <J...@nospam.infovis.co.uk> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separate Tabs, Separate Sessions BigAndy Firefox 0 05-09-2007 09:27 AM
Separate Tabs, Separate Sessions BigAndy Firefox 0 05-09-2007 09:26 AM
Separate Javascipt code from pure Perl code Nikos Perl Misc 4 05-07-2007 04:57 PM
Using separate classpaths for separate classes? Frank Fredstone Java 1 06-27-2006 06:46 AM
How to use several separate classes (separate files) to be executed in one class (another file) EvgueniB Java 1 12-15-2003 01:18 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57