-
Feb 14th, 2025, 08:58 AM
#1
Thread Starter
Member
ASP Classic INCLUDE FILE Equivalent in ASP.NETs ASPX.vb or ASPX.cs
Hello All.
ASP.NET (VB or C# Question referencing the ASPX.vb or ASPX.cs files)
In Classic ASP we use INCLUDE FILE to place code in another page and reference the code in other pages.
This helps to keep things much more organized and helpful in adding in new elements as we know what page to go to, instead of what LINE NUMBER to go to.
In ASP.NET, is there such a thing?
Can we do this within the aspx.vb or aspx.cs file?
Or do we just have to deal with large coded files only?
I was given a suggestion, which I am not certain about, which is client-side rendering. (Will have to research it to see if it is something that would work in my scenario.)
Currently, my file is at 2351 lines, which is not many compared to other projects.
However, it would be nice to break the page up into segments, to make it easier to work with.
Any ideas?
Thanks.
-
Feb 14th, 2025, 09:30 AM
#2
Re: ASP Classic INCLUDE FILE Equivalent in ASP.NETs ASPX.vb or ASPX.cs
If you are looking at making reusable UI components then aspx has the concept of user controls https://learn.microsoft.com/en-us/do...ui.usercontrol which serve a similar purpose.
-
Feb 14th, 2025, 10:04 AM
#3
Thread Starter
Member
Re: ASP Classic INCLUDE FILE Equivalent in ASP.NETs ASPX.vb or ASPX.cs
Hello, PlausiblyDamp.
Not sure that is what I am looking for.
Are you familiar with ASP Classic Include files?
Pretty much.
<%
'Your code is here. With 1000 lines.
%>
You break the code up into segments like this.
Code:
<%
'Code with 250 lines
%>
<!--#include file="page1.asp"-->
<%
'Code with 250 lines
%>
<!--#include file="page2.asp"-->
<%
'This ends the page
%>
Now, with that,
-
Feb 14th, 2025, 10:45 AM
#4
Re: ASP Classic INCLUDE FILE Equivalent in ASP.NETs ASPX.vb or ASPX.cs
That isn't really how you do things in aspx, either write the reusable code in a class or module, or use ascx if it is reusable UI.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|