Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i redirect from one link to another page at the specified line or point on the page.
eg i have a page containing description of topic1 to topic5
i have another page containing hyperlinks topic1 to topic5
now if user clicks on the hyperlink topic4 than he must be redirect to the description page but at the location where topic4 is displayed on that page.
(in c#)

hope u can understand my problem.
thanks in advance
Posted
Comments
NMehta83 8-Oct-10 6:33am    
Why you downvote? What is the wrong in the answers? Please provide the answer so next time i will take care of that.
aayu 8-Oct-10 7:04am    
NMehta how do you came to known that he has down voted you?
@nuraGGupta@ 12-Oct-10 0:21am    
Aarti...Experienced Developers have a third eye...they can smell what is being cooked around....lolzzzzzz

This has a very good solution(which I did). Place the contents inside a div to which you want to redirect the data. Each div must have a unique id, for example if you have 5 different topics then you can have div ids as
divTopic1
divTopic2
divTopic3
divTopic4
divTopic5

now, on the hyperlink, you can make the redirection as

<a href="http://www.xyz.com/topics/#topic1">topic1</a>
<a href="http://www.xyz.com/topics/#topic2">topic2</a>
<a href="http://www.xyz.com/topics/#topic3">topic3</a>
<a href="http://www.xyz.com/topics/#topic4">topic4</a>
<a href="http://www.xyz.com/topics/#topic5">topic5</a>

This could be done for dynamic topics also( if they are coming from a database) by generating corresponding ids of the div and hyperlinks.

Hope this would solve your problem.

Anurag
 
Share this answer
 
Comments
@nuraGGupta@ 8-Oct-10 4:59am    
please provide vote if this was useful to you.
yeah u gotta use Anchoring,
give the place you wanna jump to a Name, i.e.
<a name="patel">jump here <a/>and then give the link you want to hit to get to that location the <pre><a href="#patel"> this will jump to 'patel' link on this page br mode="hold" />
hope that helps.

moreinfo:
<a href="http://www.hypergurl.com/anchors.html">http://www.hypergurl.com/anchors.html</a>[<a href="http://www.hypergurl.com/anchors.html" target="_blank" title="New Window">^</a>]

sry bout the dodgy layout, i never used this 'code block' thing before..:~
 
Share this answer
 
v4
There is no need for C# or either ASP.NET for your requirement, you just can do that using HTML. You can use name property for <a> tag.

HTML Anchor name Attribute[^]

Also demo page there for your clarification.
 
Share this answer
 
If you have to make hyperlink in code behind then you should use
"System.Web.UI.HtmlControls.HtmlAnchor".

C#
System.Web.UI.HtmlControls.HtmlAnchor topic1 = new System.Web.UI.HtmlControls.HtmlAnchor();
topic1.HRef="URL";
topic1.InnerText = "Topic1";


likewise you can give for each five hyperlinks.

If this helped you then please vote and marked it as answer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900