To achieve your requirement no need to write that function in Class1.cs...Follow following Procedure
add following function is <script> block of .aspx page
<script type="text/javascript">
function OpenPopWin(varURL, varWindowName, varCaller, varKeyId, varWidth, varHeight) {
var objTransparent = document.getElementById("Transparent");
var height = document.body.clientHeight + 'px';
document.documentElement.scrollTop = 0;
if (navigator.appName == "Microsoft Internet Explorer")
objTransparent.style.height = "100%";
else
objTransparent.style.height = height;
objTransparent.style.width = "100%";
objTransparent.style.visibility = 'visible';
var varLeft = (screen.width / 2) - (varWidth / 2);
var varTop = (screen.height / 2) - (varHeight / 2);
popupWindow = window.open(varURL + 'Caller=' + varCaller + '&Id=' + varKeyId + '&ShowModal=1', varWindowName, 'width=' + (screen.width - 10) + 'px; height=' + (screen.height - 70) + 'px; top=' + 0 + '; left=' + 0 + '; location=0 ;resizable=1; scrollbars=1');
}
</script>
Now call this function from code behind...Here i assume that you have call this function on Button Click...Name of that button is Button1
protected void Button1_Click(object sender, EventArgs e)
{
// Here i assume that you want to navigate from first.aspx(Parent Window) to second.aspx(Pop-up window)
string str = Guid.NewGuid().ToString();
str = str.Replace('-', '0');
str = "w" + str;
string Name="shankumar_cst";
string url = "Second.aspx?Name=" + Name + "&";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(@"<script language='javascript'>");
sb.Append(@"OpenPopWin('" + url + "','" + str + "', 'first.aspx', '" + -1 + "', '1024', '620');");
sb.Append(@"</script>");
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "JCall2",sb.ToString(), false);
}