Exemple #1
0
        protected virtual ScriptControlDescriptor GetScriptDescriptor()
        {
            ScriptControlDescriptor scriptControlDescriptor = new ScriptControlDescriptor("PropertyPage", this.ClientID);

            scriptControlDescriptor.AddProperty("UseSetObject", this.UseSetObject, true);
            scriptControlDescriptor.AddProperty("RequireDataAtInitialize", this.RequireDataAtInitialize, true);
            BaseForm baseForm = this.Page as BaseForm;

            if (baseForm != null)
            {
                scriptControlDescriptor.AddComponentProperty("Form", "aspnetForm", true);
            }
            scriptControlDescriptor.AddClientIdProperty("ContentContainerID", this.ContentContainer);
            if (null != this.ObjectIdentity)
            {
                scriptControlDescriptor.AddScriptProperty("ObjectIdentity", this.ObjectIdentity.ToJsonString(null));
            }
            if (this.Results != null)
            {
                scriptControlDescriptor.AddProperty("JsonResults", this.Results.ToJsonString(DDIService.KnownTypes.Value));
                if (!string.IsNullOrEmpty(this.SaveMethodExpression))
                {
                    scriptControlDescriptor.AddScriptProperty("SaveMethodExpression", "function($_){ return " + this.SaveMethodExpression + "}");
                }
            }
            if (this.Bindings != null)
            {
                scriptControlDescriptor.AddScriptProperty("Bindings", this.Bindings.ToJavaScript(null));
                WebControl captionLabel = this.GetCaptionLabel();
                if (captionLabel != null && !string.IsNullOrEmpty(this.CaptionTextField))
                {
                    scriptControlDescriptor.AddScriptProperty("CaptionTextField", "function($_){ return $_." + this.CaptionTextField + "; }");
                    scriptControlDescriptor.AddElementProperty("CaptionControl", captionLabel.ClientID);
                }
            }
            scriptControlDescriptor.AddComponentProperty("RefreshWebServiceMethod", this.RefreshWebServiceMethod);
            if (!this.ReadOnly)
            {
                scriptControlDescriptor.AddComponentProperty("SaveWebServiceMethod", this.SaveWebServiceMethod);
            }
            scriptControlDescriptor.AddProperty("UseWarningPanel", this.UseWarningPanel, true);
            scriptControlDescriptor.AddProperty("SuppressWarning", this.SuppressWarning, true);
            scriptControlDescriptor.AddClientIdProperty("WarningPanelID", this.warningPanel);
            scriptControlDescriptor.AddProperty("HideClientValidationError", this.HideClientValidationError, true);
            scriptControlDescriptor.AddProperty("SaveConfirmationText", this.SaveConfirmationText, true);
            if (!string.IsNullOrEmpty(this.OnRefreshSucceed))
            {
                scriptControlDescriptor.AddScriptProperty("OnRefreshSucceed", this.OnRefreshSucceed);
            }
            if (this.NameProperty != "Name")
            {
                scriptControlDescriptor.AddProperty("NameProperty", this.NameProperty);
            }
            return(scriptControlDescriptor);
        }