473,726 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Quick Starts - <script> vs code behind

Hi;

Almost all of the Quick Starts show the code in the .aspx file inside a
<script> instead of in a seperate .aspx.cs file. My instinct is that the code
should be in a seperate file to keep the view and the view logic distinct.

Is there a strong argument for combining these in one file? (It may just
feel wrong to me because of years of J2EE/JSP programming where you always
keep them seperate.)

--
thanks - dave
Jan 30 '06 #1
5 1558
hi,

most of the time it is for sample simplification
You then just copy the sample and paste it a blank page and it works
imeddiatly
having it in separte could work also but then its more esay to make mstakes
whith something like namespace of library to include etc....
"David Thielen" wrote:
Hi;

Almost all of the Quick Starts show the code in the .aspx file inside a
<script> instead of in a seperate .aspx.cs file. My instinct is that the code
should be in a seperate file to keep the view and the view logic distinct.

Is there a strong argument for combining these in one file? (It may just
feel wrong to me because of years of J2EE/JSP programming where you always
keep them seperate.)

--
thanks - dave

Jan 30 '06 #2
There is not a strong argument for keeping everything in one file, although
some people prefer it, but it's really just their preference.
There's a good reason Visual Studio 2005 uses the code behind model by
default. Code separation is considered a good thing by most experts.
However, if I were writing the quick starts I might consider using the
single page model because it's an easier way to show all the code at once
when trying to teach somebody. That's probably the main reason they chose
that approach for the quick starts.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"David Thielen" <th*****@nospam .nospam> wrote in message
news:EB******** *************** ***********@mic rosoft.com...
Hi;

Almost all of the Quick Starts show the code in the .aspx file inside a
<script> instead of in a seperate .aspx.cs file. My instinct is that the
code
should be in a seperate file to keep the view and the view logic distinct.

Is there a strong argument for combining these in one file? (It may just
feel wrong to me because of years of J2EE/JSP programming where you always
keep them seperate.)

--
thanks - dave

Jan 30 '06 #3
Thank you. I thought that might be it but usually in a basic tutorial they do
everything the "correct" way so I figured better to ask.

--
thanks - dave
"Steve C. Orr [MVP, MCSD]" wrote:
There is not a strong argument for keeping everything in one file, although
some people prefer it, but it's really just their preference.
There's a good reason Visual Studio 2005 uses the code behind model by
default. Code separation is considered a good thing by most experts.
However, if I were writing the quick starts I might consider using the
single page model because it's an easier way to show all the code at once
when trying to teach somebody. That's probably the main reason they chose
that approach for the quick starts.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"David Thielen" <th*****@nospam .nospam> wrote in message
news:EB******** *************** ***********@mic rosoft.com...
Hi;

Almost all of the Quick Starts show the code in the .aspx file inside a
<script> instead of in a seperate .aspx.cs file. My instinct is that the
code
should be in a seperate file to keep the view and the view logic distinct.

Is there a strong argument for combining these in one file? (It may just
feel wrong to me because of years of J2EE/JSP programming where you always
keep them seperate.)

--
thanks - dave


Jan 31 '06 #4
I totally agree with you Steve
Patrick

"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message
news:OI******** ******@TK2MSFTN GP11.phx.gbl...
There is not a strong argument for keeping everything in one file, although some people prefer it, but it's really just their preference.
There's a good reason Visual Studio 2005 uses the code behind model by
default. Code separation is considered a good thing by most experts.
However, if I were writing the quick starts I might consider using the
single page model because it's an easier way to show all the code at once
when trying to teach somebody. That's probably the main reason they chose
that approach for the quick starts.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"David Thielen" <th*****@nospam .nospam> wrote in message
news:EB******** *************** ***********@mic rosoft.com...
Hi;

Almost all of the Quick Starts show the code in the .aspx file inside a
<script> instead of in a seperate .aspx.cs file. My instinct is that the
code
should be in a seperate file to keep the view and the view logic distinct.
Is there a strong argument for combining these in one file? (It may just
feel wrong to me because of years of J2EE/JSP programming where you always keep them seperate.)

--
thanks - dave


Jan 31 '06 #5
Hi,

Do you have any other concerns on this issue? Thank you!

Thanks & Regards,

Frederick Wu
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=============== =============== =============== ========
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.

This and other support options are available here:

BCPS:
https://partner.microsoft.com/US/tec...rview/40010469

Others: https://partner.microsoft.com/US/tec...pportoverview/

If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default...rnational.aspx.
=============== =============== =============== ========

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 2 '06 #6

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

Similar topics

8
5360
by: Brett Robichaud | last post by:
I understand how code-behind can handle events for a page, but can I call a code-behind method from within a <script> tag in my ASP.Net page, or can I only call methods defined in other <script> sections? I can't seem to figure out the syntax for for calling code-behind directly. The method is within the class my page inherits from and is public, but when I try to call it from my page I get this error: CS1520: Class, struct, or...
21
8537
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript" src="NO JAVASCRIPT CAN BE USED HERE" /> So I am see'g If I can use eval todo something what I am doing I have tried almost everything, following is being last one
12
62925
by: Iddo | last post by:
Hi, I am having a strange problem... I have an HTML file which has 2 script tags: 1) <script language="javascript" id="ABC" src="ABC.js" /> 2) <script id="general" language="javascript"> function foo() { alert("aaa"); } </script>
44
2828
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
2
3212
by: boczek | last post by:
Hello all. I'm writing a small async webapp. in JavaScript and I'm using <script> element technique to load data. I'm usign <scriptbecause of cross domain restrictions with XmlRequest. The problem is when I remove a element that is currently loading from DOM (with removeChild) Firefox still loads it and waits with other scripts.
2
2057
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! Error: BC30456: 'Read_DOM' is not a member of
7
1615
by: gsherp | last post by:
Is there any way to dynamically change what script included in the HTML? <span id="changeit"><script src="test1.js"></script></span> <input type="button" onClick="document.getElementById('changeit").innerHTML="<script src="test2.js"></script>" /> Is there anyway for the <script> include to take affect?
7
4277
by: labmonkey111 | last post by:
I'm having trouble with the following code: <SCRIPT> <!-- if (navigator.appName == 'Microsoft Internet Explorer') { document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"templates/94076/menu.css\" media=\"screen, print\" />"); document.write("<script src=\"templates/94076/menu.js\" language=\"javascript\" type=\"text/javascript\"></script>"); } else { document.write("<link rel=\"stylesheet\" type=\"text/css\"...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9259
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8101
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.