コード例 #1
0
        private void RegisterReturnScript()
        {
            using (LogGroup logGroup = LogGroup.Start("Registering EntitySelectDeliverer return script.", NLog.LogLevel.Debug))
            {
                string text = (string)WebControlUtilities.GetFieldValue(WebControlUtilities.FindControlRecursive(Page, TextControlID), "Text", typeof(String));

                StringBuilder builder = new StringBuilder();

                builder.Append("<script language='javascript' defer>\n");
                builder.Append("window.opener.AddItem_" + GetRequesterID() + "('" + EntityID + "', '" + WebUtilities.EncodeJsString(text) + "');\n");
                builder.Append("window.close();\n");


                builder.Append("</script>\n");


                if (!Page.ClientScript.IsClientScriptBlockRegistered("EntitySelectDelivererReturnScript"))
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(EntitySelectDeliverer), "EntitySelectDelivererReturnScript", builder.ToString());
                }
                else
                {
                    LogWriter.Debug("Return script already registered.");
                }
            }
        }
コード例 #2
0
 static public object GetFieldValue(Control field, string controlValuePropertyName, Type returnType)
 {
     return(WebControlUtilities.GetFieldValue(field, controlValuePropertyName, returnType));
 }