I am trying to call a javascript function from asp.net codebehind using onclientclick for a linkbutton. Code is like this:
string x = "redirecttoimagepage"+"("+ y+")";//y has an int value i need and it varies
lnkimagepage.OnClientClick = x;
i need to use the value y in the javascript function for using.
function redirecttoimagepage(variable)
{
var strURL = "Subpages.aspx?tabID="+variable;
window.open(strURL,"_blank");
return true;
}
Right now, with the code i have shared, it doesnt do anything. After the link is clicked, it stays in the same page. What am i doing wrong? Appreciate all your help guys. Thanks a lot!