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.EventArg s, pageURL as
String)
Response.Redire ct(pageURL)
End Sub
What are the advantages or disadvantages of each method?
Which one should I use?
Thanks,
Miguel 3 2125
"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*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.EventArg s, pageURL as String) Response.Redire ct(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********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
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 "disadvanta ges" 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.Redire ct
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.Redire ct 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.Redire ct, you can use a QueryString
to send data to the new page. Note that with Response.Redire ct, 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.Redire ct 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.Redire ct 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.*DELETE 2SEND*com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.EventArg s, pageURL as String) Response.Redire ct(pageURL) End Sub
What are the advantages or disadvantages of each method?
Which one should I use?
Thanks, Miguel
Thanks Kevin for your description of the most common options I have.
I will be useful in the future.
Cheers,
Miguel
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:ke***@DIES PAMMERSDIEtakem pis.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 "disadvanta ges" 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.Redire ct 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.Redire ct 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.Redire ct, you can use a QueryString to send data to the new page. Note that with Response.Redire ct, 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.Redire ct 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.Redire ct 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.*DELETE 2SEND*com> wrote in message news:%2******** ********@TK2MSF TNGP12.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.EventArg s, pageURL as String) Response.Redire ct(pageURL) End Sub
What are the advantages or disadvantages of each method?
Which one should I use?
Thanks, Miguel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 errorrrrrrrrrrrr. Im just going crazy.
Error: Access denied!
|
by: chris |
last post by:
how would i resize a browser window to a specific size as the page loads,
using html or javascript
|
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.
I think there is a window.addEventListener() function but I am not sure
which event to listen to.
Thank you.
|
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 know. But- it's an OFFSITE link. Fundamentally untrackable.
This is my comprimise... when you click on that link, Javascript
executes a function in half-second before the page unloads. That
fuction loads an external image. (purely into memory...
|
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.
Using buttons for loading new content works fine. But i still want to
use a function which is callable per javascript. I think this way is
more flexable than using the Buttons, becaus every button needs it's
own Sub-Routine. But i want to have...
| |
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
Javascript functions to build large expanding/collapsing tables to
display the data.
The original developer wrote the page so that many writeln functions
were called in embedded Javascript to actually write the table as the
page was loading....
|
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 the title field gets its information from a previouse page so its value can easily be over 40 chars. (I can not restrict the length on the previouse page.)
The major dificulty is that there is no form on the aspx page, and I do not have access to...
|
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 simple
construction to do this:
jsJSNode = document.createElement(“script”);
jsJSNode.type = “text/javascript”;
jsJSNode.src = “http:// den-01/Default.aspx“;
document.body.appendChild(jsMyNode);
|
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 from the page load event of the page?
I am able to run the function when there is a change in, say, a text box, by
adding the following to the page load event:
TextBox.Attributes.Add("onChange", "javascript:myfunction()")
|
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: 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...
| |
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: 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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |