Solved

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

Posted on 2004-08-21
3
166 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check my code out(2) 2 54
C# Single Form 8 27
Wav problem 4 13
Windows Media Player 2 11
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now