Hai I have written a code for a hyperlink and now I need to redirect this page to another page,how can I do that?

                HtmlAnchor htmlanchor = new HtmlAnchor();
                htmlanchor.HRef = "#";
                htmlanchor.InnerText = myLabel1.Text;
                this.form1.Controls.Add(htmlanchor);

I don't understand. Do you mean point the hyperlink to another page? Just assign the .href properly the value of the URL.

If you mean redirecting, user the response.redirect method.

Response.redirect("www.domain.com");

Not sure what you really want to do but you could just create a link using asp.net like you are doing except have the link created in javascript code....like

htmlanchor.InnerText = "<a href='javascript:window.location.href(" & chr(34) & "http://www.google.com" & chr(34) & ")'>" & myLabel1.Text & "</a>";

that should create a link that forces the current page to google.com.

Hope that helps,
Larry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.