So, i have an aspx page which looks like this:
<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"Default.aspx.cs\" Inherits=\"_Default\" %>
You can call C# method by making it webmethod. See this URL: http://www.xdevsoftware.com/blog/post/Call-WebMethod-from-Javascript-in-ASPNET.aspx in Javascript it is call pagemethod.
But for your example, i would suggest you just pre-populate value pagewho? using asp.net tags when HTML is rendered by asp .net.
Example (in javascript):
GoToLink("<%= YourCodeBehindMethodReturingURLToPutHere() %>");
Reference: http://weblogs.asp.net/ahmedmoosa/archive/2010/10/06/embedded-code-and-inline-server-tags.aspx