Click hyperlink, navigateurl to common page and send the text of the hyperlink as a parameter

I want to assume a variable number of hyperlinks, each with a unique name and id that all launch a common aspx file that needs the text of the hyperlink to know what to do in the page load event of the common aspx file. Also how to retrieve that hyperlink text in the page load event of that new page.

Bob
LVL 1
bob_mechlerProgrammerAsked:
Who is Participating?
 
Rajar AhmedConsultantCommented:
try this mate..
string urltext = "abc,gef,ghi";  //Small demo which has diffvalues 
            string[] demouniqe = urltext.Split(',');
          
            foreach (string eachstring in demouniqe) 
            {
                HyperLink hyp = new HyperLink();
                hyp.Text = eachstring;
                hyp.NavigateUrl = "test.aspx?st=" + eachstring; //Change this to ur page which u need to redirect
                form1.Controls.Add(hyp);                           //Adding Hyperlink Dynamically..
                form1.Controls.Add(new LiteralControl("<br/>")); 
            }
       
//test.aspx.cs
//in page load ::
  if (string.IsNullOrEmpty(Request.QueryString["st"])==false)
        {
            Response.Write("HyperLink Text=" + Request.QueryString["st"]); // this is the code u need to ve in the opening page 
        }

Open in new window

0
 
bob_mechlerProgrammerAuthor Commented:
From the sample, I was able to continue searching in the right direction. Thanks,
0
 
bob_mechlerProgrammerAuthor Commented:
Being new at ASP.NET it's easier for me to ask questions in context and learn what I need to know about html. The VB.NET part is coming pretty easy since it's more like the programming I've been doing for the last 4 years with the Windows API and VB6
Thanks,
Bob
0
 
Rajar AhmedConsultantCommented:
Hi Mate .. Ya u will enjoy coding in .net  am sure..!

But Why B ..??With ur question i can able to only direct towards a solution ..As der was no code!
As my solution produced a result for ur task kindly Assign A . !

Meerano3
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.