Create javascript method dynamically
//Create javascript method dynamically
//create a scring variable and write your javascript code with dynamic values
string focusScript = "<script language='javascript'>" +
"window.opener.document.getElementById('" + checkval + "').value = '" + Hidden1.Value + "';"
+ "window.opener.document.getElementById('" + checkval5 + "').value = '" + dg + "';"
+ "window.close();"
+ "</script>";
// Add the JavaScript code to the page.
if (!ClientScript.IsStartupScriptRegistered("FocusScript"))
ClientScript.RegisterStartupScript(typeof(Page), "FocusScript", focusScript);