473,473 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Load Page. VB vs Javascript. Need opinion. Thank You.

Hello,

I am working on an ASP.NET/VB web site.
I have several links including menu links.

Considerer a want to load a page named page.aspx.

I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArgs, pageURL as
String)
Response.Redirect(pageURL)
End Sub

What are the advantages or disadvantages of each method?

Which one should I use?

Thanks,
Miguel

Nov 19 '05 #1
3 2095
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in news:
#J**************@TK2MSFTNGP12.phx.gbl:
I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArgs, pageURL as
String)
Response.Redirect(pageURL)
End Sub

What are the advantages or disadvantages of each method?


Javascript can be disabled.

Server side will require a round trip. But a server side transfer will
allow you to log what happened (or do additional processing).

Personally I'll choose a sever side transfer.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Think of these software entities as tools. In that context, think of one as
a Framing hammer, and one as a Finishing hammer. Now, in that context, how
would you answer the following question:
What are the advantages or disadvantages of each method?
Answer: There are no "advantages" or "disadvantages" to either. There are
properties and characteristics. Neither good nor bad, unless used in some
context. For example, a Framing hammer is perfect for framing. A Finishing
hammer is perfect for finishing. But a Framing hammer will make a mess if
you use it for finishing, and a finishing hammer will take forever to build
a frame.

Again, using the hammer analogy, how would you answer the following:
Which one should I use?
Answer: Use the tool that has the characteristics and properties that are
appropriate for the given situation. If you're building the frame of a
house, use a framing hammer. If youre putting in moulding, use a finishing
hammer.

So much for the philosophy. Now let me answer your specific questions, posed
in a more appropriate fashion:

What are the characteristics and properties of each method?

Actually, you have more options than the ones you mentioned, such as:

Client-side:
JavaScript
Hyperlink
Server-side:
Response.Redirect
Server.Transfer

And a few others that are much less common, and used for special purposes.

On the client side, a hyperlink is the simplest method to load a different
document into the browser, and if you're strictly talking about links in a
menu, I would go with that. Remember that the links can also include
QueryStrings to pass data to the new page. You can use JavaScript if you
need additional client-side processing, need to open the page in a new
window (which you can also do with a hyperlink, but with less control over
the window), or for somewhat more complex situations.

On the server side, Response.Redirect is often useful, as it causes the
browser to make a second request for the new document. The Redirect
directive is added to the HTTP headers in the Response, causing the browser
to load the new document. With Response.Redirect, you can use a QueryString
to send data to the new page. Note that with Response.Redirect, you are
sending a GET request for the new page. Server.Transfer can be useful in
situations where you need to transfer server-side resources and memory from
one page instance to the other. Note that Server.Transfer does NOT tell the
browser to request a different page, but transfers server-side processing to
the new page, and the browser "thinks" it is still looking at the same page
(URL).

When should I use one or the other?

Again, a hyperlink is the simplest and fastest way of transferring to a new
page. with the addition of a QueryString to the hyperlink, you can also send
data to the new page. JavaScript is also fast, but a little more complex,
and is useful in situations where you need to do additional CLIENT-side
processing, or have control over a new window, such as resizing it, or
setting up the status bar, and other browser elements in the new window.

Response.Redirect can be the simplest way of transferring to a new page, if,
for example, you have some server-side condition that changes and requires a
redirect to a new page. Rather than returning the same page to the client,
and requiring additional client-side processing to transfer, you can do the
Redirect which causes the browser to request the new page, without looking
as if it had received the first page in the first place. However, it should
be noted that Response.Redirect actually causes the browser to make TWO
Requests, one for the first page, and one for the redirected page, and
involves some network latency. Server.Transfer has the advantage of not
requiring a second Request from the browser, but remember that it returns a
new page with the same URL as the original page. Server.Transfer can be
useful when you want to do a partial Response from one page, and finish it
from another.

If you keep these characteristics of each method in mind, it should become
apparent at what time(s) to use which method(s).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Hello,

I am working on an ASP.NET/VB web site.
I have several links including menu links.

Considerer a want to load a page named page.aspx.

I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArgs, pageURL as String)
Response.Redirect(pageURL)
End Sub

What are the advantages or disadvantages of each method?

Which one should I use?

Thanks,
Miguel

Nov 19 '05 #3
Thanks Kevin for your description of the most common options I have.
I will be useful in the future.

Cheers,
Miguel

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ke***@DIESPAMMERSDIEtakempis.com:
Think of these software entities as tools. In that context, think of one as
a Framing hammer, and one as a Finishing hammer. Now, in that context, how
would you answer the following question:

What are the advantages or disadvantages of each method?

Answer: There are no "advantages" or "disadvantages" to either. There are
properties and characteristics. Neither good nor bad, unless used in some
context. For example, a Framing hammer is perfect for framing. A Finishing
hammer is perfect for finishing. But a Framing hammer will make a mess if
you use it for finishing, and a finishing hammer will take forever to build
a frame.

Again, using the hammer analogy, how would you answer the following:

Which one should I use?

Answer: Use the tool that has the characteristics and properties that are
appropriate for the given situation. If you're building the frame of a
house, use a framing hammer. If youre putting in moulding, use a finishing
hammer.

So much for the philosophy. Now let me answer your specific questions, posed
in a more appropriate fashion:

What are the characteristics and properties of each method?

Actually, you have more options than the ones you mentioned, such as:

Client-side:
JavaScript
Hyperlink
Server-side:
Response.Redirect
Server.Transfer

And a few others that are much less common, and used for special purposes.

On the client side, a hyperlink is the simplest method to load a different
document into the browser, and if you're strictly talking about links in a
menu, I would go with that. Remember that the links can also include
QueryStrings to pass data to the new page. You can use JavaScript if you
need additional client-side processing, need to open the page in a new
window (which you can also do with a hyperlink, but with less control over
the window), or for somewhat more complex situations.

On the server side, Response.Redirect is often useful, as it causes the
browser to make a second request for the new document. The Redirect
directive is added to the HTTP headers in the Response, causing the browser
to load the new document. With Response.Redirect, you can use a QueryString
to send data to the new page. Note that with Response.Redirect, you are
sending a GET request for the new page. Server.Transfer can be useful in
situations where you need to transfer server-side resources and memory from
one page instance to the other. Note that Server.Transfer does NOT tell the
browser to request a different page, but transfers server-side processing to
the new page, and the browser "thinks" it is still looking at the same page
(URL).

When should I use one or the other?

Again, a hyperlink is the simplest and fastest way of transferring to a new
page. with the addition of a QueryString to the hyperlink, you can also send
data to the new page. JavaScript is also fast, but a little more complex,
and is useful in situations where you need to do additional CLIENT-side
processing, or have control over a new window, such as resizing it, or
setting up the status bar, and other browser elements in the new window.

Response.Redirect can be the simplest way of transferring to a new page, if,
for example, you have some server-side condition that changes and requires a
redirect to a new page. Rather than returning the same page to the client,
and requiring additional client-side processing to transfer, you can do the
Redirect which causes the browser to request the new page, without looking
as if it had received the first page in the first place. However, it should
be noted that Response.Redirect actually causes the browser to make TWO
Requests, one for the first page, and one for the redirected page, and
involves some network latency. Server.Transfer has the advantage of not
requiring a second Request from the browser, but remember that it returns a
new page with the same URL as the original page. Server.Transfer can be
useful when you want to do a partial Response from one page, and finish it
from another.

If you keep these characteristics of each method in mind, it should become
apparent at what time(s) to use which method(s).

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello,

I am working on an ASP.NET/VB web site.
I have several links including menu links.

Considerer a want to load a page named page.aspx.

I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArgs, pageURL as String)
Response.Redirect(pageURL)
End Sub

What are the advantages or disadvantages of each method?

Which one should I use?

Thanks,
Miguel


Nov 19 '05 #4

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

Similar topics

1
by: sean | last post by:
var strPath = "c:\myXml.xml"; var objDom = new ActiveXObject("Msxml2.DOMDocument"); alert('step 1'); objDom.load(strPath); alert('step 2'); ................ AFTER step 1 I'm getting an...
25
by: chris | last post by:
how would i resize a browser window to a specific size as the page loads, using html or javascript
6
by: sylcheung | last post by:
Hi, How can I be notified when the document load is complet in JavaScript? I am referring to the whold document load is complete, mean all images/external files/frame/iframes have been loaded. ...
4
by: ReGenesis0 | last post by:
Okay, this involves integrating javascript with PHP (though you don't have to know PHP to understand my question.) I have a page. It has a link. When someoen clicks on the link, iw ant to...
2
by: A.Wussow | last post by:
Hi Everybody, i want to load dynamically content from some user controls (with forms, or some data-controls) using atlas. So i use an UpdatePanel for loading the user control into a placeholder....
3
by: The alMIGHTY N | last post by:
I have an XSL file that works with a typically large XML data set generated dynamically from a database. This data is written to the HTML result as a deep multi-dimensional array that is used by...
8
by: sneddo | last post by:
Ok I am trying to do the above, I have got a script that will restrict the length but it requires the user to enter the field and hit a key, before it will work. This would normaly be find, but...
9
by: Denis | last post by:
Hello, Maybe somebody already solved this task. I need to load JS asynchronously without blocking browser. This means that I do not need to block browser to load/render during loading script. The...
5
by: =?Utf-8?B?TWF0Y29u?= | last post by:
Hello, I have a asp.net 2.0 (vb.net) page, which uses a master page, and there is a javascript function (myfunction) defined in the <headof that master page. Is there a way to run the function...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
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.