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

Posted on 2009-12-20
Last Modified: 2012-08-14
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.

Question by:bob_mechler
    LVL 18

    Accepted Solution

    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/>")); 
    //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


    Author Closing Comment

    From the sample, I was able to continue searching in the right direction. Thanks,

    Author Comment

    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
    LVL 18

    Expert Comment

    by:Rajar Ahmed
    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 . !


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    759 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

    13 Experts available now in Live!

    Get 1:1 Help Now