Пример #1
0
        /// <summary>
        /// Binds a data source to the invoked server control and all its child controls.
        /// </summary>
        public override void  DataBind()
        {
            string className = "";

            if (DataItem != null)
            {
                MetaObject mo = null;

                if (DataItem is MetaObject)
                {
                    mo = (MetaObject)DataItem;
                }
                else if (DataItem is BusinessObjectRequest)
                {
                    mo = ((BusinessObjectRequest)DataItem).MetaObject;
                }

                className = mo.GetMetaType().Name;
                if (mo.GetCardMetaType() != null)
                {
                    className = mo.GetCardMetaType().Name;
                }
                ViewState["ClassName"] = className;

                if (String.IsNullOrEmpty(FormName))
                {
                    if (DataItem is MetaObject)
                    {
                        FormName = FormController.BaseFormType;
                    }
                    else if (DataItem is BusinessObjectRequest)
                    {
                        FormName = FormController.CreateFormType;
                    }
                }
            }
            else if (ViewState["ClassName"] != null)
            {
                className = ViewState["ClassName"].ToString();
            }

            FormDocument doc = FormController.LoadFormDocument(className, FormName);

            if (doc != null)
            {
                _formExists = true;
                fRenderer.FormDocumentData = doc;
                fRenderer.FormType         = FormType;
                fRenderer.PlaceName        = PlaceName;
                if (DataItem != null)
                {
                    fRenderer.DataItem = DataItem;
                }
                fRenderer.DataBind();
            }
        }