PDA

View Full Version : Create linkbutton to activate hyperlink in C#.net



fishjelly
September 4th, 2008, 04:53 AM
I want to create a linkButton to activate my hyperlink which will open a new page in a new window. I would like to know how to code the codes for activate the hyperlink which I wish to place it in the 'onclick' event of the linkButton.
Thanks!...

kirupa
September 4th, 2008, 05:21 AM
Hi fishjelly!
For WPF, the code is Process.Start("http://www.foo.com"). For Silverlight, the code is HtmlPage.Window.Navigate(new Uri("http://www.foo.com"));

Cheers!
Kirupa :)

fishjelly
September 4th, 2008, 09:23 PM
Hi fishjelly!
For WPF, the code is Process.Start("http://www.foo.com"). For Silverlight, the code is HtmlPage.Window.Navigate(new Uri("http://www.foo.com"));

Cheers!
Kirupa :)


Hi Kirupa!
What if I am using Visual Studio 2005?

Thanks!
fishjelly

kirupa
September 4th, 2008, 10:23 PM
It should still work provided it is at least a C# 2.0 project. What error are you getting?

fishjelly
September 4th, 2008, 11:07 PM
It should still work provided it is at least a C# 2.0 project. What error are you getting?

Hmm...The error is:
The name 'Process' does not exist in the current context

This is my codes.I have a textBox to retrieve the user key in url path.
Is there any codes to trigger the hyperlink?

protected void LinkButton1_Click(object sender, EventArgs e)
{

testHyperLink.NavigateUrl = urlTextBox.Text;

// code to tigger the hyperlink

}

Thanks!

kirupa
September 4th, 2008, 11:42 PM
Just add a Reference (http://www.kirupa.com/blend_silverlight/adding_references_using_directives_pg1.htm)

Right click on Process, and click on the Resolve button to choose the namespace to fix it :)

fishjelly
September 5th, 2008, 12:30 AM
Just add a Reference (http://www.kirupa.com/blend_silverlight/adding_references_using_directives_pg1.htm)

Right click on Process, and click on the Resolve button to choose the namespace to fix it :)


Hi Kirupa!
Thanks!!!...I solve the problem already...really thanks a lot... :}