예제 #1
0
        //Used to apply default style to cells
        public void applyMyStyle(WebControl webcontrol)
        {
            TableItemStyle itemstyle = new TableItemStyle();

            itemstyle.BorderWidth = 1;
            itemstyle.Font.Size   = FONTSIZE;
            itemstyle.BorderColor = System.Drawing.Color.DarkBlue;

            webcontrol.ApplyStyle(itemstyle);
        }
 private void RenderStyle(HtmlTextWriter writer, WebControl control, string className, MenuItemStyle style, bool applyInlineBorder)
 {
     if (!string.IsNullOrEmpty(className))
     {
         control.CssClass = className;
         if (applyInlineBorder)
         {
             writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none");
             writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "1em");
         }
     }
     else if (style != null)
     {
         control.ApplyStyle(style);
     }
 }
 private void RenderStyle(HtmlTextWriter writer, WebControl control, string className, MenuItemStyle style, bool applyInlineBorder)
 {
     if (!String.IsNullOrEmpty(className))
     {
         control.CssClass = className;
         if (applyInlineBorder)
         {
             // Add inline style to force the border to none to override any CssClass (VSWhidbey 336610)
             writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none");
             // And an inline font-size of 1em to avoid squaring relative font sizes by applying them twice
             writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "1em");
         }
     }
     else if (style != null)
     {
         control.ApplyStyle(style);
     }
 }
예제 #4
0
        private void SetChildProperties()
        {
            EnsureChildControls();
            _logInLinkButton.Visible   = false;
            _logInImageButton.Visible  = false;
            _logOutLinkButton.Visible  = false;
            _logOutImageButton.Visible = false;
            WebControl control = null;

            if (LoggedIn)
            {
                string logoutImageUrl = LogoutImageUrl;
                if (logoutImageUrl.Length > 0)
                {
                    _logOutImageButton.AlternateText = LogoutText;
                    _logOutImageButton.ImageUrl      = logoutImageUrl;
                    control = _logOutImageButton;
                }
                else
                {
                    _logOutLinkButton.Text = LogoutText;
                    control = _logOutLinkButton;
                }
            }
            else
            {
                string loginImageUrl = LoginImageUrl;
                if (loginImageUrl.Length > 0)
                {
                    _logInImageButton.AlternateText = LoginText;
                    _logInImageButton.ImageUrl      = loginImageUrl;
                    control = _logInImageButton;
                }
                else
                {
                    _logInLinkButton.Text = LoginText;
                    control = _logInLinkButton;
                }
            }
            control.CopyBaseAttributes(this);
            control.ApplyStyle(base.ControlStyle);
            control.Visible = true;
        }
예제 #5
0
        /* TextAlign sera dans chaque reponse donc pas dans le XML mais dans la BD
         * sinon cela n'a pas de sens pour l'utilisateur
         * TextAlign n'existe pas dans le Style
         */
        public static void ApplyStyleWeb(string nomStyle, string typeStyle, WebControl webControl)
        {
            // C'est un peu loufoque mais comme le boulot de lier un nom de membre a un
            // questionnaire etait deja fait il est repris ici
            // une reflexion plus global devrait etre mene pour par exemple
            // configurer une nouvelle variable SessionState.Membre dans login.cs
            // par exemple
            string membre = WebContent.GetUtilisateur();

            StyleWeb sw = new StyleWeb();
            Style    st = new Style();

            try
            {
                sw = XmlStyleWebProvider.GetStyleWeb(membre, nomStyle, typeStyle);
                st = StyleWeb.StyleWebToStyle(sw);
                if (sw.Applicable)
                {
                    webControl.ApplyStyle(st);

                    if (typeStyle == TypeStyleWeb.Table)
                    {
                        // On aurait bien aimé utiliser Unit() ici mais CellPadding et CellSpacing sont des int !
                        // Tandis que Height et Width sont des Unit()
                        if (sw.Padding != "")
                        {
                            (( Table )webControl).CellPadding = int.Parse(sw.Padding);
                        }
                        if (sw.Spacing != "")
                        {
                            (( Table )webControl).CellSpacing = int.Parse(sw.Spacing);
                        }
                    }
                }
            }
            catch
            {
                // Mettre un break point pour detecter les erreurs Xml
                int i = 3;
            }
        }
예제 #6
0
    private void applyStyleOnPreRenderComplete()
    {
        WebControl wc = ( WebControl )PanelObjet.FindControl("ObjetID");

        wc.ApplyStyle(primaryStyle);

        // On dirait comme un BUG ...
        // si primaryStyle.Width.IsEmpty alors wc.Width n'est pas affecte
        // et conserve son ancienne valeur !!
        // un comble non ?
        if (primaryStyle.Width.IsEmpty)
        {
            wc.Width = new Unit();
        }
        if (primaryStyle.Height.IsEmpty)
        {
            wc.Height = new Unit();
        }
        if (primaryStyle.Font.Size.IsEmpty)
        {
            wc.Font.Size = new FontUnit();
        }
    }
예제 #7
0
        protected virtual void InitializeItem(SiteMapNodeItem item)
        {
            switch (item.ItemType)
            {
            case SiteMapNodeItemType.Root:
                if (RootNodeTemplate != null)
                {
                    item.ApplyStyle(NodeStyle);
                    item.ApplyStyle(RootNodeStyle);
                    RootNodeTemplate.InstantiateIn(item);
                }
                else if (NodeTemplate != null)
                {
                    item.ApplyStyle(NodeStyle);
                    item.ApplyStyle(RootNodeStyle);
                    NodeTemplate.InstantiateIn(item);
                }
                else
                {
                    WebControl c = CreateHyperLink(item);
                    c.ApplyStyle(NodeStyle);
                    c.ApplyStyle(RootNodeStyle);
                    item.Controls.Add(c);
                }
                break;

            case SiteMapNodeItemType.Current:
                if (CurrentNodeTemplate != null)
                {
                    item.ApplyStyle(NodeStyle);
                    item.ApplyStyle(CurrentNodeStyle);
                    CurrentNodeTemplate.InstantiateIn(item);
                }
                else if (NodeTemplate != null)
                {
                    item.ApplyStyle(NodeStyle);
                    item.ApplyStyle(CurrentNodeStyle);
                    NodeTemplate.InstantiateIn(item);
                }
                else if (RenderCurrentNodeAsLink)
                {
                    HyperLink c = CreateHyperLink(item);
                    c.ApplyStyle(NodeStyle);
                    c.ApplyStyle(CurrentNodeStyle);
                    item.Controls.Add(c);
                }
                else
                {
                    Literal c = CreateLiteral(item);
                    item.ApplyStyle(NodeStyle);
                    item.ApplyStyle(CurrentNodeStyle);
                    item.Controls.Add(c);
                }
                break;

            case SiteMapNodeItemType.Parent:
                if (NodeTemplate != null)
                {
                    item.ApplyStyle(NodeStyle);
                    NodeTemplate.InstantiateIn(item);
                }
                else
                {
                    WebControl c = CreateHyperLink(item);
                    c.ApplyStyle(NodeStyle);
                    item.Controls.Add(c);
                }
                break;

            case SiteMapNodeItemType.PathSeparator:
                if (PathSeparatorTemplate != null)
                {
                    item.ApplyStyle(PathSeparatorStyle);
                    PathSeparatorTemplate.InstantiateIn(item);
                }
                else
                {
                    Literal h = new Literal();
                    h.Text = PathSeparator;
                    item.ApplyStyle(PathSeparatorStyle);
                    item.Controls.Add(h);
                }
                break;
            }
        }
예제 #8
0
        internal void RenderPropertyEditors(HtmlTextWriter writer, string[] propertyDisplayNames, string[] propertyDescriptions,
                                            WebControl[] propertyEditors, string[] errorMessages)
        {
            Debug.Assert(propertyDisplayNames.Length == propertyEditors.Length);
            Debug.Assert(propertyDisplayNames.Length == errorMessages.Length);
            Debug.Assert(propertyDescriptions == null || (propertyDescriptions.Length == propertyDisplayNames.Length));

            if (propertyDisplayNames.Length == 0)
            {
                return;
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "4");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            for (int i = 0; i < propertyDisplayNames.Length; i++)
            {
                WebControl editUIControl = propertyEditors[i];
                if (Zone != null && !Zone.EditUIStyle.IsEmpty)
                {
                    editUIControl.ApplyStyle(Zone.EditUIStyle);
                }

                string propertyDescription = (propertyDescriptions != null) ? propertyDescriptions[i] : null;
                if (!String.IsNullOrEmpty(propertyDescription))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, propertyDescription);
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                if (editUIControl is CheckBox)
                {
                    editUIControl.RenderControl(writer);
                    writer.Write("&nbsp;");
                    RenderDisplayName(writer, propertyDisplayNames[i], editUIControl.ClientID);
                }
                else
                {
                    string           associatedClientID;
                    CompositeControl compositeControl = editUIControl as CompositeControl;
                    if (compositeControl != null)
                    {
                        // The <label for> tag should point to the first child control of the
                        // composite control. (VSWhidbey 372756)
                        associatedClientID = compositeControl.Controls[0].ClientID;
                    }
                    else
                    {
                        // The <label for> tag should point to the editUIControl itself.
                        associatedClientID = editUIControl.ClientID;
                    }

                    RenderDisplayName(writer, propertyDisplayNames[i] + ":", associatedClientID);
                    writer.WriteBreak();
                    writer.WriteLine();
                    editUIControl.RenderControl(writer);
                }
                writer.WriteBreak();
                writer.WriteLine();

                string errorMessage = errorMessages[i];
                if (!String.IsNullOrEmpty(errorMessage))
                {
                    if (Zone != null && !Zone.ErrorStyle.IsEmpty)
                    {
                        Zone.ErrorStyle.AddAttributesToRender(writer, this);
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    writer.WriteEncodedText(errorMessage);
                    writer.RenderEndTag();  // Span
                    writer.WriteBreak();
                    writer.WriteLine();
                }

                writer.RenderEndTag();  // Td
                writer.RenderEndTag();  // Tr
            }

            writer.RenderEndTag();  // Table
        }
 internal void RenderPropertyEditors(HtmlTextWriter writer, string[] propertyDisplayNames, string[] propertyDescriptions, WebControl[] propertyEditors, string[] errorMessages)
 {
     if (propertyDisplayNames.Length != 0)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
         writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "4");
         writer.RenderBeginTag(HtmlTextWriterTag.Table);
         for (int i = 0; i < propertyDisplayNames.Length; i++)
         {
             WebControl control = propertyEditors[i];
             if ((this.Zone != null) && !this.Zone.EditUIStyle.IsEmpty)
             {
                 control.ApplyStyle(this.Zone.EditUIStyle);
             }
             string str = (propertyDescriptions != null) ? propertyDescriptions[i] : null;
             if (!string.IsNullOrEmpty(str))
             {
                 writer.AddAttribute(HtmlTextWriterAttribute.Title, str);
             }
             writer.RenderBeginTag(HtmlTextWriterTag.Tr);
             writer.RenderBeginTag(HtmlTextWriterTag.Td);
             if (control is CheckBox)
             {
                 control.RenderControl(writer);
                 writer.Write("&nbsp;");
                 this.RenderDisplayName(writer, propertyDisplayNames[i], control.ClientID);
             }
             else
             {
                 string           clientID;
                 CompositeControl control2 = control as CompositeControl;
                 if (control2 != null)
                 {
                     clientID = control2.Controls[0].ClientID;
                 }
                 else
                 {
                     clientID = control.ClientID;
                 }
                 this.RenderDisplayName(writer, propertyDisplayNames[i] + ":", clientID);
                 writer.WriteBreak();
                 writer.WriteLine();
                 control.RenderControl(writer);
             }
             writer.WriteBreak();
             writer.WriteLine();
             string str3 = errorMessages[i];
             if (!string.IsNullOrEmpty(str3))
             {
                 if ((this.Zone != null) && !this.Zone.ErrorStyle.IsEmpty)
                 {
                     this.Zone.ErrorStyle.AddAttributesToRender(writer, this);
                 }
                 writer.RenderBeginTag(HtmlTextWriterTag.Span);
                 writer.WriteEncodedText(str3);
                 writer.RenderEndTag();
                 writer.WriteBreak();
                 writer.WriteLine();
             }
             writer.RenderEndTag();
             writer.RenderEndTag();
         }
         writer.RenderEndTag();
     }
 }
예제 #10
0
        public Control CreateControl(IConfigurationElement controlElement, string index, IBinder binder, ITemplatingItem item, WebControl container, TableItemStyle invalidStyle, Dictionary <string, Control> registry, WebPartManager manager)
        {
            if (null == this._monitor)
            {
                throw new ApplicationException("Monitor not set");
            }
            Control result;

            if (!controlElement.Attributes.ContainsKey("proxy") && !controlElement.Attributes.ContainsKey("type"))
            {
                result = null;
            }
            else
            {
                Control cellControl     = null;
                string  cellControlName = null;
                if (controlElement.Attributes.ContainsKey("proxy"))
                {
                    object proxyIDValue = controlElement.GetAttributeReference("proxy").Value;
                    string proxyID      = null;
                    if (null != proxyIDValue)
                    {
                        proxyID = proxyIDValue.ToString();
                    }
                    if (string.IsNullOrEmpty(proxyID))
                    {
                        result = null;
                        return(result);
                    }
                    Control proxy = ReflectionServices.FindControlEx(proxyID, manager);
                    if (null == proxy)
                    {
                        this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException("can't find proxy " + proxyID), EVENT_TYPE.Error));
                    }
                    string proxyMember = null;
                    if (!controlElement.Attributes.ContainsKey("proxyMember"))
                    {
                        this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException("proxyMember not found for proxy " + proxyID), EVENT_TYPE.Error));
                    }
                    else
                    {
                        proxyMember = controlElement.GetAttributeReference("proxyMember").Value.ToString();
                    }
                    try
                    {
                        cellControl     = (ReflectionServices.ExtractValue(proxy, proxyMember) as Control);
                        cellControlName = proxy + "." + proxyMember;
                    }
                    catch (Exception ex)
                    {
                        this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, ex, EVENT_TYPE.Error));
                    }
                    if (cellControl == null && null != proxy)
                    {
                        this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException(string.Format("member {0} of proxy type {1} is not a Control", proxyMember, proxy.GetType().FullName)), EVENT_TYPE.Error));
                    }
                }
                else
                {
                    Control scope = container;
                    if (container is TableCell)
                    {
                        scope = container.Parent.Parent;
                    }
                    try
                    {
                        cellControl     = this.CreateControl(controlElement.GetAttributeReference("type").Value.ToString(), new bool?(item == null || item.IsReadOnly), scope);
                        cellControlName = controlElement.GetAttributeReference("type").Value.ToString();
                    }
                    catch (Exception ex)
                    {
                        this._monitor.Register(this, this._monitor.NewEventInstance("create control error", null, ex, EVENT_TYPE.Error));
                    }
                }
                if (null == cellControl)
                {
                    result = null;
                }
                else
                {
                    string type = null;
                    if (controlElement.Attributes.ContainsKey("type"))
                    {
                        type = controlElement.GetAttributeReference("type").Value.ToString();
                        if (cellControl is IButtonControl)
                        {
                            IButtonControl btn = cellControl as IButtonControl;
                            if (("Commander" == type || "LinkCommander" == type) && !controlElement.Attributes.ContainsKey("command"))
                            {
                                this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("create {0} error", type), null, new ApplicationException("command not found"), EVENT_TYPE.Error));
                            }
                            else
                            {
                                if (controlElement.Attributes.ContainsKey("command"))
                                {
                                    btn.CommandName = controlElement.GetAttributeReference("command").Value.ToString();
                                }
                            }
                            btn.CommandArgument = index;
                        }
                        if (cellControl is StatelessDropDownList)
                        {
                            ((StatelessDropDownList)cellControl).CommandArgument = index;
                        }
                    }
                    if (null != registry)
                    {
                        registry.Add(controlElement.ConfigKey, cellControl);
                    }
                    var properties = controlElement.Elements.Values;
                    foreach (IConfigurationElement controlPropertyElement in properties)
                    {
                        if (!controlPropertyElement.Attributes.ContainsKey("for") || !("cell" == controlPropertyElement.GetAttributeReference("for").Value.ToString()))
                        {
                            string propertyName = null;
                            if (!controlPropertyElement.Attributes.ContainsKey("member"))
                            {
                                this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("'{0}' property set error", cellControlName), null, new ApplicationException(string.Format("member not found for '{0}'", controlPropertyElement.ConfigKey)), EVENT_TYPE.Error));
                            }
                            else
                            {
                                propertyName = controlPropertyElement.GetAttributeReference("member").Value.ToString();
                            }

                            IExpression expression = null;
                            LWAS.Extensible.Interfaces.IResult expressionResult = null;
                            if (controlPropertyElement.Elements.ContainsKey("expression"))
                            {
                                IConfigurationElement expressionElement = controlPropertyElement.GetElementReference("expression");
                                Manager sysmanager = manager as Manager;
                                if (null != sysmanager && null != sysmanager.ExpressionsManager && expressionElement.Attributes.ContainsKey("type"))
                                {
                                    expression = sysmanager.ExpressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression;
                                    if (null != expression)
                                    {
                                        try
                                        {
                                            expression.Make(expressionElement, sysmanager.ExpressionsManager);
                                            expressionResult = expression.Evaluate();
                                        }
                                        catch (ArgumentException ax)
                                        {
                                        }
                                    }
                                }
                            }

                            object defaultValue = null;
                            if (!string.IsNullOrEmpty(propertyName) && controlPropertyElement.Attributes.ContainsKey("value"))
                            {
                                defaultValue = controlPropertyElement.GetAttributeReference("value").Value;
                                if (null == expression || null == binder)
                                {
                                    try
                                    {
                                        if (string.IsNullOrEmpty(cellControlName) ||
                                            propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty ||
                                            (propertyName == this.KnownTypes[cellControlName].ReadOnlyProperty && defaultValue != null && !string.IsNullOrEmpty(defaultValue.ToString())))
                                        {
                                            if (propertyName == "Watermark")
                                            {
                                                if (null != defaultValue && !String.IsNullOrEmpty(defaultValue.ToString()))
                                                {
                                                    ReflectionServices.SetValue(cellControl, propertyName, defaultValue);
                                                }
                                            }
                                            else
                                            {
                                                ReflectionServices.SetValue(cellControl, propertyName, defaultValue);
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("'{0}'.'{1}'='{2}' error", cellControlName, propertyName, controlPropertyElement.GetAttributeReference("value").Value), null, ex, EVENT_TYPE.Error));
                                    }
                                }
                                else
                                {
                                    IBindingItem bindingItem = binder.NewBindingItemInstance();
                                    bindingItem.Source = new Dictionary <string, object>()
                                    {
                                        { "0", defaultValue }
                                    };
                                    bindingItem.SourceProperty             = "0";
                                    bindingItem.Target                     = cellControl;
                                    bindingItem.TargetProperty             = propertyName;
                                    bindingItem.Expression                 = expression;
                                    bindingItem.ExpressionEvaluationResult = expressionResult;
                                    binder.BindingItems.Add(bindingItem);
                                }
                            }

                            if (controlPropertyElement.Attributes.ContainsKey("isList") && (bool)controlPropertyElement.GetAttributeReference("isList").Value)
                            {
                                object list = null;
                                try
                                {
                                    list = ReflectionServices.ExtractValue(cellControl, propertyName);
                                    if (null == list)
                                    {
                                        throw new InvalidOperationException(string.Format("Member '{0}' is empty", propertyName));
                                    }
                                    if (!(list is ListItemCollection) && !(list is IDictionary <string, object>))
                                    {
                                        throw new InvalidOperationException(String.Format("Unsupported list type '{0}'", list.GetType().Name));
                                    }
                                }
                                catch (Exception ex)
                                {
                                    this._monitor.Register(this, this._monitor.NewEventInstance("failed to retrive the list", null, ex, EVENT_TYPE.Error));
                                }
                                if (null != list)
                                {
                                    if (controlPropertyElement.Attributes.ContainsKey("hasEmpty") && (bool)controlPropertyElement.GetAttributeReference("hasEmpty").Value)
                                    {
                                        if (list is ListItemCollection)
                                        {
                                            ((ListItemCollection)list).Add("");
                                        }
                                        else if (list is Dictionary <string, object> )
                                        {
                                            ((Dictionary <string, object>)list).Add("", "");
                                        }
                                    }
                                    foreach (IConfigurationElement listItemElement in controlPropertyElement.Elements.Values)
                                    {
                                        string value = null;
                                        string text  = null;
                                        string pull  = null;
                                        if (listItemElement.Attributes.ContainsKey("value") && null != listItemElement.GetAttributeReference("value").Value)
                                        {
                                            value = listItemElement.GetAttributeReference("value").Value.ToString();
                                        }
                                        if (listItemElement.Attributes.ContainsKey("text") && null != listItemElement.GetAttributeReference("text").Value)
                                        {
                                            text = listItemElement.GetAttributeReference("text").Value.ToString();
                                        }
                                        if (listItemElement.Attributes.ContainsKey("pull") && null != listItemElement.GetAttributeReference("pull").Value)
                                        {
                                            pull = listItemElement.GetAttributeReference("pull").Value.ToString();
                                        }

                                        if (list is ListItemCollection)
                                        {
                                            ListItem li = new ListItem(text, value);
                                            ((ListItemCollection)list).Add(li);
                                            if (null != binder && !String.IsNullOrEmpty(pull))
                                            {
                                                IBindingItem bindingItem = binder.NewBindingItemInstance();
                                                bindingItem.Source         = item.Data;
                                                bindingItem.SourceProperty = pull;
                                                bindingItem.Target         = li;
                                                bindingItem.TargetProperty = "Text";
                                                bindingItem.Expression     = expression;
                                                binder.BindingItems.Add(bindingItem);
                                            }
                                        }
                                        else if (list is Dictionary <string, object> )
                                        {
                                            ((Dictionary <string, object>)list).Add(value, text);
                                            if (null != binder && !String.IsNullOrEmpty(pull))
                                            {
                                                IBindingItem bindingItem = binder.NewBindingItemInstance();
                                                bindingItem.Source         = item.Data;
                                                bindingItem.SourceProperty = pull;
                                                bindingItem.Target         = list;
                                                bindingItem.TargetProperty = value;
                                                bindingItem.Expression     = expression;
                                                binder.BindingItems.Add(bindingItem);
                                            }
                                        }
                                    }
                                }
                            }
                            if (controlPropertyElement.Attributes.ContainsKey("property"))
                            {
                                if (container.Page != null && null != binder)
                                {
                                    IBindingItem bindingItem = binder.NewBindingItemInstance();
                                    bindingItem.Source         = WebPartManager.GetCurrentWebPartManager(container.Page);
                                    bindingItem.SourceProperty = "WebParts." + controlPropertyElement.GetAttributeReference("property").Value.ToString();
                                    bindingItem.Target         = cellControl;
                                    bindingItem.TargetProperty = propertyName;
                                    if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty)
                                    {
                                        bindingItem.DefaultValue = defaultValue;
                                    }
                                    bindingItem.Expression = expression;
                                    binder.BindingItems.Add(bindingItem);
                                }
                            }
                            if (controlPropertyElement.Attributes.ContainsKey("pull"))
                            {
                                string pull = controlPropertyElement.GetAttributeReference("pull").Value.ToString();
                                if (binder != null && null != item)
                                {
                                    IBindingItem bindingItem = binder.NewBindingItemInstance();
                                    bindingItem.Source         = item.Data;
                                    bindingItem.SourceProperty = pull;
                                    bindingItem.Target         = cellControl;
                                    bindingItem.TargetProperty = propertyName;
                                    if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty)
                                    {
                                        bindingItem.DefaultValue = defaultValue;
                                    }
                                    bindingItem.Expression = expression;
                                    binder.BindingItems.Add(bindingItem);
                                    if (item.InvalidMember == bindingItem.SourceProperty)
                                    {
                                        container.ApplyStyle(invalidStyle);
                                    }
                                }
                                if (this.IsDesignEnabled && propertyName == this.KnownTypes[cellControlName].WatermarkProperty)
                                {
                                    // StyleTextBox has its own Watermark feature
                                    if (typeof(StyledTextBox).IsInstanceOfType(cellControl))
                                    {
                                        ReflectionServices.SetValue(cellControl, "Watermark", pull);
                                    }
                                    else
                                    {
                                        container.Attributes.Add("watermark", pull);
                                    }
                                }
                            }
                        }
                    }
                    result = cellControl;
                }
            }
            return(result);
        }
예제 #11
0
파일: BaseChrome.cs 프로젝트: t1b1c/lwas
 protected virtual void RenderVerbControl(HtmlTextWriter writer, WebControl control)
 {
     control.ApplyStyle(base.Zone.TitleBarVerbStyle);
     control.Page = base.WebPartManager.Page;
     control.RenderControl(writer);
 }