adsense

Friday, July 30, 2021

asp.net linkbutton open in a new window

 Asp.Net linkbutton can be made to work the same way as a normal hyperlink does. All we have to do is to attach a onClick attribute as displayed below.

 

 string strURL = "";
string strWinTitle = "";
string strWinProperty = "";


strURL =  "https://www.google.com/";
stTitle = "New Window";
strProperty = "toolbar=no,menubar=no,location=no";


linkBtn.Attributes.Add("onClick", "javascript:window.open('" + strURL + "','" + stTitle + "','" + strProperty + "');return false;")


Cheers,

Samitha