[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

Code for Button to Open this Stie

I need code for a button click event which opens this site.

Code:

protected void cmdEvalStock_Click(object sender, EventArgs e)
        // Open the site for Experts Exchange
        {
                 http://www.experts-exchange.com/  // Open this site in a separate tab

         }

Thanks
0
Dovberman
Asked:
Dovberman
  • 2
2 Solutions
 
Meir RivkinFull stack Software EngineerCommented:
u don't have to handle the button click if the url is predefined.
add client click handler to the button on Page_Load:

protected void Page_Load(object sender, EventArgs e)
{
    cmdEvalStock.OnClientClick="javascript:window.open('  http://www.experts-exchange.com');";
}

Open in new window

0
 
Monica PCommented:
Design :

<input type="button" value="open" />

Open in new window


Jquery to open in new Tab

$("input").click(function() {
   window.open("http://www.experts-exchange.com");
});

Open in new window


Test : http://jsfiddle.net/f8zqg/152/
0
 
DovbermanAuthor Commented:
I am more familiar with code behind.

protected void Button1_Click (object sender, System.EventArgs e)
{
    this.HyperLink1.Text = "Home";
    this.HyperLink1.NavigateUrl = "http://www.experts-exchange.com";
}

I understand the advantages of javascript and will work on it.

Thank you
0
 
DovbermanAuthor Commented:
Thank you
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now