473,320 Members | 1,804 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,320 software developers and data experts.

Code behind not in separate file

I didn't choose "code in separate file" when creating a web page. So I have
to use the fully qualified object names because I can't figure out where, or
even if i can, put the Imports statement. Can anyone shed some light on
this? What are the limitations when you have the server-side code in the
aspx file?
Dec 1 '06 #1
2 900

Terry Olsen wrote:
I didn't choose "code in separate file" when creating a web page. So I have
to use the fully qualified object names because I can't figure out where, or
even if i can, put the Imports statement. Can anyone shed some light on
this? What are the limitations when you have the server-side code in the
aspx file?
Hi,

When you are using server side codes in aspx page , you can still use
the import statement but in a different way.

just put the import statement below you page declaration

<%@ Page Language="C#" %>
<%@ Import Namespace="MyPackage.MyNameSpace" %>

thats it...

But its better to use code behind file.

Code behind file is introduced to make your code more maintainable
and separating the code logic from the page helps enforce the MVC
pattern.

Thanks
Masudur
kaz Software Ltd.
www.kaz.com.bd

Dec 1 '06 #2
Hi,

Terry Olsen wrote:
I didn't choose "code in separate file" when creating a web page. So I have
to use the fully qualified object names because I can't figure out where, or
even if i can, put the Imports statement. Can anyone shed some light on
this? What are the limitations when you have the server-side code in the
aspx file?
There are many disadvantages to having the code in the ASPX file. First,
you don't have the clean separation between UI and code, then you must
publish the uncompiled code to the server, and finally as you found out,
linking to other libraries is more difficult.

I strongly recommend you to use code-behind files.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 1 '06 #3

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

Similar topics

37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
19
by: Alan Silver | last post by:
Hello, I have been developing ASP.NET with a text editor so far (better way to learn initially), and have now been trying Visual Web Developer. I want to create a project for an existing site...
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. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.