You don't convert it... you just create a new hyperlink, or use an existing hyperlink and assign the ID to the value of the querystring. For example:

Your Uri: http://www.mysite.com/page.aspx?hyperlinkName=lnk1

Now in your page code-behind you can do either of the following:

[Example 1]
protected hyperLinkControlOnPage;

protected void Page_Load(object sender, EventArgs e)
{
      hyperLinkControlOnPage.ID = Request.QueryString["hyperlinkName"];     
}

[Example 2]
protected void Page_Load(object sender, EventArgs e)
{
      HyperLink hl = new HyperLink();
      hl.ID = Request.QueryString["hyperlinkName"];
      hl.Text = "whatever";
      hl.NavigateUrl = "somepage.aspx";
      this.Controls.Add(hl);
}

-Brian

-----Original Message-----
From: Lude Gullit [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 11, 2004 5:12 PM
To: [EMAIL PROTECTED]
Subject: [C#.NET] How to convert type


Hi,

I assign the name of one HyperLink (lnk1)to a query string, When I
request the query string in another page, I still want to use the
value of query string as a HyperLink name, so how to convert the
Value of type 'String' to 'System.Web.UI.WebControls.HyperLink'?

Thanks






Yahoo! Groups Sponsor
ADVERTISEMENT





Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/CSharpNET/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=298184.5584357.6650215.3001176/D=groups/S=:HM/A=2426683/rand=702048403


Yahoo! Groups Links

Reply via email to