Currently, I am facing an issue with calling a JavaScript function from my ASP.NET codebehind through the use of onclientclick for a link button. Here is how my code looks:
string x = "redirectToImagePage"+"("+ y+")"; // The variable 'y' contains an integer value that varies
lnkImagePage.OnClientClick = x;
I require the value of 'y' in the JavaScript function for further usage.
function redirectToImagePage(variable)
{
var strURL = "Subpages.aspx?tabID="+variable;
window.open(strURL,"_blank");
return true;
}
Unfortunately, the current implementation does not seem to be working as expected. Upon clicking the link, it simply remains on the same page. Can anyone help me identify what might be going wrong here? Your assistance will be greatly appreciated. Thank you!