[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

can hyperlink do server.transfer?

Posted on 2005-04-16
9
Medium Priority
?
1,169 Views
Last Modified: 2008-01-09
hi

am i correct in saying that the hyperlink control does a "response.redirect" when clicked on?  if yes, how can I get the hyperlink control to do a "server.transfer" instead?

thanks
0
Comment
Question by:narmi2
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 1

Author Comment

by:narmi2
ID: 13799146
this is kind of urgent :)
0
 
LVL 5

Assisted Solution

by:RogerSTHLM
RogerSTHLM earned 300 total points
ID: 13799438
Hi there

In a client (browser) point of view....

Server.transer is....
The client request the web server for a file but (on the server side) redirects to another file. The client have no clue this is happening. It is just aware its first file was requested.

Response.redirect is....
The client request a file on the web server. It's getting an answer; "request another file (=what you want it to redirect)", and it makes a second request. This request is shown to the user.

So... The answer to your question. No - a hyperlink doesn't do a response.redirect, neither a server.transfer. It will do _one_ request to the server the same way as entering "http://www.yourdomain.com/aRequest.aspx" in your browser.

Hope this will help you. Cheers
R
0
 
LVL 7

Assisted Solution

by:ayha1999
ayha1999 earned 300 total points
ID: 13799713
HI,

I thin Instead of server.Transfer, you can pass all fields you want to pass to next page in a querysring using.

ayha

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 12

Assisted Solution

by:laotzi2000
laotzi2000 earned 600 total points
ID: 13799854
You can do a little trick here:

<a href="http://www.google.com" onclick="javascript:Form1.submit();return false;">link</a>

when you click on the link, it will postback, then in your page_load event handler, you can
do server.transfer depending on some other things, such as IsPostBack.
0
 
LVL 1

Author Comment

by:narmi2
ID: 13800455
is there on simpler more .net way of telling a standard hyperlink control or hyperlinkcolumn of a datagrid to do the server.transfer thing?
0
 
LVL 12

Assisted Solution

by:laotzi2000
laotzi2000 earned 600 total points
ID: 13801213
don't think so. Hyperlink control has no server side event, so you have to do it yourself
0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 300 total points
ID: 13801932
well you could use the LinkButton

<asp:LinkButton Id="lbNavigate" RunAt="Server" CausesValidation="False">Go</asp:LinkButton>

and in your code-behind

Private Sub lbNavigate_Click(ByVal sender As Object,ByVal e As EventArgs) Handles lbNavigate.Click
      'example of passing data from the first page to another
      Context.Items("Item1") = 1202
      Server.Transfer("~/mypages.aspx",False)
End Sub

0
 
LVL 23

Expert Comment

by:b1xml2
ID: 13801936
The LinkButton Control will be rendered on the client side as an Anchor Element <A>
0
 
LVL 1

Author Comment

by:narmi2
ID: 13802037
i know about the linkbutton being able to do this, but how can i do that in a datagrid, datalist, or a repeater?  I have tried doing this in a repeater but cant seem to get it to work.  

if i have a database with the following columns

MyURLDisplayName
MyURLValue

I then was able make a repeater which listed all the urls in the database correctly.  what i cant figure out is how to use the clicked linkbutton in the repeater and use the MyURLValue related to it in codebehind?

and ideas?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question