This is a simple, newbe question.
In Asp/VB there are 2 ways to display message on page load
I can double click on aspx page and aspx.vb file is created:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
'Here I can crete my message
Response.Write( "Page loaded")
End Sub
Alternatively, I can create script which will do same thing:
<script language="vb" runat="server">
Sub Page_Load(Sende r As Object, E As EventArgs)
Response.Write( "page loaded")
Edn Sub
</script>
Why there are 2 way to do same thing? Which one is correct/better? Are there any differences? 8 1443
The first way with the aspx way is nicer, because it splits the GUI
layer from the code layer. Otherwise you mix HTML, ASP and VB code all
in one file an it will get a mess eventually. In ASP.NET 2.0 they even
go one step further and put all code that was generated by the IDE in a
third file.
In terms of function it makes not difference, neither really in terms
of performance.
Remy Blaettler
Helping you collaborate better! www.collaboral.com
Remy wrote: In terms of function it makes not difference, neither really in terms of performance.
It actually does make a great difference. If you place the code inline,
that page will get compiled the first time it is browsed into one DLL.
Every other page like that will also get compiled into one separate DLL. If
you have a lot of pages, what you end up with is a large number of small
DLLs strewn all over memory. This greatly increases your chances of seeing
an OutOfMemory condition due to a failure to allocate a contiguous block of
memory to grow the managed heap.
By using code-behind (and setting debug = false in your web.config), you
alleviate this problem because your application is batch compiled. That
means that instead of one DLL for each page, you have one DLL for each
folder that contains all of the types in that folder.
I see this problem a lot.
--
Jim Cheshire
JIMCO Software http://www.jimcosoftware.com
On Wed, 19 Oct 2005 22:19:24 -0500, "JIMCO Software"
<co*******@jimc osoftware.com> wrote: Remy wrote: In terms of function it makes not difference, neither really in terms of performance.
It actually does make a great difference. If you place the code inline, that page will get compiled the first time it is browsed into one DLL.
Webforms with inline code will still participate in batch compilation.
You can even mix code-behind forms and inline code forms in the same
directory and the runtime will batch compile to one dll (assuming the
conditions are right for batch compilation).
--
Scott http://www.OdeToCode.com/blogs/scott/
Also, if you are displaying large amounts of data, it's better to let
the server do the work. We originally were importing all the data to
the client via XML and traversing the data there with inline code.
When the XML blob got too big, the application was dragging. So, we
moved everything to code behind and it's running just fine.
Just my thoughts...
--
Rosanne
------------------------------------------------------------------------
Rosanne's Profile: http://www.highdots.com/forums/m283
View this thread: http://www.highdots.com/forums/t3039550
Scott Allen wrote: On Wed, 19 Oct 2005 22:19:24 -0500, "JIMCO Software" <co*******@jimc osoftware.com> wrote: It actually does make a great difference. If you place the code inline, that page will get compiled the first time it is browsed into one DLL.
Webforms with inline code will still participate in batch compilation. You can even mix code-behind forms and inline code forms in the same directory and the runtime will batch compile to one dll (assuming the conditions are right for batch compilation).
Right you are. I had my mind on using the Src attribute. Thanks for the
correction.
--
Jim Cheshire
JIMCO Software http://www.jimcosoftware.com
recommended coding style examples can be found in starter kits at www.asp.net
------------------------------------------------------------------------------------
I would much rather chew on tinfoil than code in C#.
Thanks all for response.
Also, what I noticed, with code behind, if I enter, for instance, Imports
System. = I will selection of all valid options.
It looks like I cannot get this if using inline code, unless my settings are
wrong.
john
"Jon Paal" <Jon nospam Paal @ everywhere dot com> wrote in message
news:e7******** ******@tk2msftn gp13.phx.gbl... recommended coding style examples can be found in starter kits at www.asp.net ------------------------------------------------------------------------------------ I would much rather chew on tinfoil than code in C#. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JTrigger |
last post by:
I am rather new to the XML and XSD world and was wondering what the code
would look like to write the following XSD items as classes in C# with all
the proper XML attributes to make them serializable. Thanks in advance.
<xsd:complexType name="Order">
<xsd:sequence>
<xsd:element ref="OrderHeader"/>
|
by: JTrigger |
last post by:
I am rather new to the XML and XSD world and was wondering what the code
would look like to write the following XSD items as classes in C# with all
the proper XML attributes to make them serializable. Thanks in advance.
<xsd:complexType name="Order">
<xsd:sequence>
<xsd:element ref="OrderHeader"/>
|
by: liljencrantz |
last post by:
Hi,
I have a piece of code that uses hashtables to store pointers to
various bits of data. The hashtable sees all pointers as const void *,
while the application obviously uses various other pointer types for
the data. I've run into a warning with the following code:
void hash_remove( hash_table_t *h,
const void *key,
const void **old_key,
|
by: ToddLMorgan |
last post by:
Summary:
How should multiple (related) projects be arranged (structured) and
configured so that the following is possible:
o Sharing common code (one of the projects would be a "common"
project referenced by all others and likely the others would share at
least the common project and possibly more as times goes on)
o Clear separation of "production" code and "test" code (ie to
readily ship source and test as separate components. Usually...
|
by: Zytan |
last post by:
I can scroll a WebBrowser to the bottom like so:
if (webControl.Document != null)
webControl.Document.Body.ScrollTop = int.MaxValue;
But, if I include a proper DOCTYPE (for XHTML 1.1 DTD) like so:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
| |
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
|
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...
|
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...
|
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();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |