Example #1
0
        public static void WriteWindowClose(FreeFormView freeForm)
        {
            HttpContext.Current.Response.Write("<script language='javascript'>");
            if ((freeForm != null) && (freeForm.Values.Count > 0))
            {
                HttpContext.Current.Response.Write("var _v='");
                int i = 0;
                foreach (DictionaryEntry entry in freeForm.Values)
                {
                    string key = entry.Key as string;
                    if (key == null)
                    {
                        continue;
                    }

                    if (i > 0)
                    {
                        HttpContext.Current.Response.Write('&');
                    }

                    HttpContext.Current.Response.Write("_p_");
                    HttpContext.Current.Response.Write(ConvertUtilities.EscapeJavascript(key));
                    HttpContext.Current.Response.Write('=');
                    HttpContext.Current.Response.Write(ConvertUtilities.EscapeJavascript(string.Format("{0}", entry.Value)));
                    i++;
                }
                HttpContext.Current.Response.Write("';if(window.opener)window.opener.returnValue=_v;window.returnValue=_v;");
            }
            HttpContext.Current.Response.Write("window.close();</script>");
            HttpContext.Current.Response.End();
        }