Solved

capturing which link was clicked on so that I can dynamically build page header text.

Posted on 2004-08-21
3
169 Views
Last Modified: 2010-04-15
I need to dynamically change/assign certian text elements in my page headers depending upon which hyperlinks my users click on. I have a page header, left navigation bar and footer. All of these sections are built using pagecontrols.

The header section in turn inherits two pagecontrols. One page control is for the navigation, the other is photo and text material. It is this photo and text material that I would like to change based upon which hyperlink is clicked in the web site. In order to do this, I believe I need to find a way to capture the link click event and then change the header pagecontrol text and photo content based upon this information.

Thanks for any help or suggestions with this.

wmsunder.
0
Comment
Question by:wmsunder
3 Comments
 
LVL 1

Accepted Solution

by:
SeanStapleton earned 125 total points
ID: 11863239
For a small number of predefined links, use the asp:linkbutton control for your hyperlinks and capture the click event for each link. If you've built page controls, this should be straightforward for you. You could build a helper function, called by each click handler to do the dirty work.

Even for an unknown or variable number of links (db generated), this approach could work. As you generate the links on the page, assign the click event for each link to the same event handler.

LinkButton link;
foreach (data in some table)
{
  link = new LinkButton();
  link.Text = "My text";
  ...
  link.Click += new EventHandler(this.LinkClickHandler);
}

private void LinkClickHandler(object sender, System.EventArgs e)
{
     LinkButton clickedLink = (LinkButton)sender;
     string linkText = clickedLick.Text;
}
0
 
LVL 3

Assisted Solution

by:bigjim2000
bigjim2000 earned 125 total points
ID: 11870579
Look into the method:
Request.UrlReferrer();

It tells you the URL from which page the user came from.

-Eric
0
 

Author Comment

by:wmsunder
ID: 11919285
Problem was solved with an unrelated work-around. Points split and awarded to the two respondants.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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