Inheritance: System.Web.UI.Control, IAttributeAccessor
Exemple #1
0
        /// <summary>
        /// 增加表头
        /// </summary>
        /// <param name = "strTableTitle"></param>
        /// <param name = "tb"></param>
        public void CreateTitle(System.Web.UI.WebControls.WebControl ct, params string[] strTableTitle)
        {
            TableRow  tr;
            TableCell htc;
            Label     lblData;

            //
            tr = new TableRow();

            tr.Font.Size = strFontSize;
            htc          = new TableCell();
            htc.Controls.Add(ct);
            tr.Controls.Add(htc);
            for (int i = 0; i < strTableTitle.Length; i++)
            {
                htc        = new TableCell();
                lblData    = new Label();
                lblData.ID = "label" + mtb.ID + i.ToString();
                lblData.EnableViewState = false;
                lblData.Text            = strTableTitle[i];

                htc.Controls.Add(lblData);
                tr.Controls.Add(htc);
            }
            mtb.Controls.Add(tr);
            SetWidth();
        }
        protected void GetSelectedKitOptions(Product product)
        {
            _SelectedKitProducts = new List <int>();
            //COLLECT ANY KIT VALUES
            foreach (ProductKitComponent pkc in product.ProductKitComponents)
            {
                // FIND THE CONTROL
                KitComponent component = pkc.KitComponent;

                if (component.InputType == KitInputType.IncludedHidden)
                {
                    foreach (KitProduct choice in component.KitProducts)
                    {
                        _SelectedKitProducts.Add(choice.Id);
                    }
                }
                else
                {
                    System.Web.UI.WebControls.WebControl inputControl = (System.Web.UI.WebControls.WebControl)AbleCommerce.Code.PageHelper.RecursiveFindControl(phOptions, component.UniqueId);
                    if (inputControl != null)
                    {
                        IList <int> kitProducts = component.GetControlValue(inputControl);
                        foreach (int selectedKitProductId in kitProducts)
                        {
                            _SelectedKitProducts.Add(selectedKitProductId);
                        }
                    }
                }
            }
        }
Exemple #3
0
        protected override void OnPreRender(EventArgs e)
        {
            //if (!this.Page.IsClientScriptBlockRegistered(this.GetType().FullName + "_transfer"))
            //{
            //    this.Page.RegisterClientScriptBlock(this.GetType().FullName + "_transfer", this.placeJavascript());
            //}

            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("ToolTipScript"))
            {
                this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "ToolTipScript", this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "Lamassau.Web.UI.WebControls.Resources.Scripts.tooltip.js"));
            }


            if (this.ParentControl != String.Empty)
            {
                //ondblclick
                System.Web.UI.WebControls.WebControl control = (System.Web.UI.WebControls.WebControl) this.Parent.FindControl(this.ParentControl);
                control.Attributes.Add("AlignNote", this.AlignNote.ToString());
                control.Attributes.Add("vAlignNote", this.vAlignNote.ToString());
                control.Attributes.Add("NoteID", this.ClientID + "_note");

                //onmouseover="show_note(this);" onclick="clip_note(this)" onmouseout="hide_note(this);"
                control.Attributes.Add("ondblclick", "javascript:clip_note(this);");
                control.Attributes.Add("onmouseover", "javascript:show_note(this);");
                control.Attributes.Add("onmouseout", "javascript:hide_note(this);");
            }


            base.OnPreRender(e);
        }
Exemple #4
0
 public static void RemoveDirty(WebControl control)
 {
     if (control != null)
     {
         control.CssClass = "";
     }
 }
Exemple #5
0
        /// <summary>
        /// Returns the report control as html string.
        /// </summary>
        public static string ToHtml(this Web.UI.WebControls.WebControl webControl)
        {
            string result = "";

            StringBuilder  sb;
            StringWriter   stWriter;
            HtmlTextWriter htmlWriter;

            sb         = new StringBuilder();
            stWriter   = new StringWriter(sb);
            htmlWriter = new HtmlTextWriter(stWriter);

            //this.RenderControl(htmlWriter);
            webControl.RenderBeginTag(htmlWriter);

            foreach (Control control in webControl.Controls)
            {
                control.RenderControl(htmlWriter);
            }

            webControl.RenderEndTag(htmlWriter);

            result = sb.ToString();

            return(result);
        }
        public sealed override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner) {
            string cssClass = String.Empty;
            bool renderInlineStyle = true;

            if (_owner.IsSet(PROP_CSSCLASS)) {
                cssClass = _owner.CssClass;
            }
            if (RegisteredCssClass.Length != 0) {
                renderInlineStyle = false;
                if (cssClass.Length != 0) {
                    cssClass = cssClass + " " + RegisteredCssClass;
                }
                else {
                    cssClass = RegisteredCssClass;
                }
            }

            if (cssClass.Length > 0) {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
            }

            if (renderInlineStyle) {
                CssStyleCollection styleAttributes = GetStyleAttributes(owner);
                styleAttributes.Render(writer);
            }
        }
Exemple #7
0
		// What is baseControl for ?
		public void RenderRepeater (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
		{
			PrintValues (user);
			RepeatLayout layout = RepeatLayout;
			bool listLayout = layout == RepeatLayout.OrderedList || layout == RepeatLayout.UnorderedList;

			if (listLayout) {
				if (user != null) {
					if ((user.HasHeader || user.HasFooter || user.HasSeparators))
						throw new InvalidOperationException ("The UnorderedList and OrderedList layouts do not support headers, footers or separators.");
				}

				if (OuterTableImplied)
					throw new InvalidOperationException ("The UnorderedList and OrderedList layouts do not support implied outer tables.");

				int cols = RepeatColumns;
				if (cols > 1)
					throw new InvalidOperationException ("The UnorderedList and OrderedList layouts do not support multi-column layouts.");
			}
			if (RepeatDirection == RepeatDirection.Vertical) {
				if (listLayout)
					RenderList (w, user, controlStyle, baseControl);
				else
					RenderVert (w, user, controlStyle, baseControl);
			} else {
				if (listLayout)
						throw new InvalidOperationException ("The UnorderedList and OrderedList layouts only support vertical layout.");
				RenderHoriz (w, user, controlStyle, baseControl);
			}
		}
Exemple #8
0
        private static void StyleControl(WebControl control)
        {
            if (control == null || control is TableCell || control is LinkButton) return;

            if (control is Label) control.CssClass.Toggle("ErrorLabel", "{0} {1}");
            else control.CssClass.Toggle("ErrorItem", "{0} {1}");
        }
Exemple #9
0
 /// <summary>
 /// 将list绑定到控件上
 /// </summary>
 /// <param name="defaultValue">默认选中值</param>
 public static void BindLst <T>(System.Web.UI.WebControls.WebControl c, List <T> lst, string textField, string valueField, string value, bool flag)
 {
     if (null != lst && lst.Count > 0)
     {
         if (c is DropDownList)
         {
             DropDownList ddl = ((DropDownList)c);
             ddl.DataSource     = lst;
             ddl.DataTextField  = textField;
             ddl.DataValueField = valueField;
             ddl.DataBind();
             if (!string.IsNullOrEmpty(value))
             {
                 ddl.SelectedValue = value;
             }
             if (flag)
             {
                 ddl.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--请选择--", "-1"));
             }
         }
         else if (c is RadioButtonList)
         {
             RadioButtonList rb = ((RadioButtonList)c);
             rb.DataSource     = lst;
             rb.DataTextField  = textField;
             rb.DataValueField = valueField;
             rb.DataBind();
             if (!string.IsNullOrEmpty(value))
             {
                 rb.SelectedValue = value;
             }
         }
     }
 }
 void EditString_Init(object sender, EventArgs e)
 {
     if (IsNotAListOfValues)
     {
         var ctlTextBox = new TextBox {TextMode = TextBoxMode.SingleLine, Rows = 1};
         CtlValueBox = ctlTextBox;
         if (ValidationRule != "")
         {
             StrValRule = ValidationRule;
             StrValMsg = ValidationMessage;
         }
     }
     else
     {
         var ctlListControl = GetListControl();
         AddListItems(ctlListControl);
         CtlValueBox = ctlListControl;
     }
     Value = DefaultValue;
     if (Required) CtlValueBox.CssClass = "dnnFormRequired";
     if (!String.IsNullOrEmpty( Style)) CtlValueBox.Style.Value = Style;
     CtlValueBox.ID = CleanID(FieldTitle);
     ValueControl = CtlValueBox;
     Controls.Add(CtlValueBox);
 }
Exemple #11
0
        public static WebControl makeCell(Directory directory)
        {
            WebControl td = new WebControl(HtmlTextWriterTag.Td);
            //td.BorderWidth = Unit.Pixel(1);
            td.Style.Add(HtmlTextWriterStyle.Padding, "1em");
            td.Style.Add(HtmlTextWriterStyle.VerticalAlign, "top");
            td.CssClass += "vcard";

            Panel textPanel = new Panel();
            textPanel.Style.Add("float", "left");
            Panel namePanel = new Panel();
            namePanel.CssClass += "n ";
            namePanel.CssClass += "fn ";
            namePanel.Controls.Add(makeLastName(directory));
            namePanel.Controls.Add(makeFirstNames(directory));
            textPanel.Controls.Add(namePanel);
            textPanel.Controls.Add(makeAddress(directory));
            textPanel.Controls.Add(makeGeneralEmails(directory));
            textPanel.Controls.Add(makePersonEmails(directory));
            textPanel.Controls.Add(makeGeneralPhones(directory));
            textPanel.Controls.Add(makePersonPhones(directory));
            td.Controls.Add(textPanel);
            if (directory.photo != null && directory.photo.Id != null && directory.photo.PicasaEntry != null)
            {
                Panel picturePanel = new Panel();
                picturePanel.Style.Add("float", "right");
                picturePanel.Controls.Add(makeGeneralPhoto(directory));
                td.Controls.Add(picturePanel);
            }

            return td;
        }
 /// <summary>
 /// 設置Selector
 /// </summary>
 /// <param name="ctrlTrigger">控件ID--按鈕</param>
 /// <param name="ctrlCode">控件ID--文本框1</param>
 /// <param name="ctrlName">控件ID--文本框2</param>
 /// <param name="flag">Selector區分標誌</param>
 public void SetSelector(WebControl ctrlTrigger, Control ctrlCode, Control ctrlName, string flag, string moduleCode)
 {
     if (ctrlCode is TextBox) { (ctrlCode as TextBox).Attributes.Add("readonly", "readonly"); }
     if (ctrlName is TextBox) { (ctrlName as TextBox).Attributes.Add("readonly", "readonly"); }
     ctrlTrigger.Attributes.Add("onclick", string.Format("return setSelector('{0}','{1}','{2}','{3}')",
         ctrlCode.ClientID, ctrlName.ClientID, flag, moduleCode));
 }
 public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
 {
     base.AddAttributesToRender(writer, owner);
     if (!this.Wrap)
     {
         if (this.IsControlEnableLegacyRendering(owner))
         {
             writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
         }
         else
         {
             writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
         }
     }
     System.Web.UI.WebControls.HorizontalAlign horizontalAlign = this.HorizontalAlign;
     if (horizontalAlign != System.Web.UI.WebControls.HorizontalAlign.NotSet)
     {
         TypeConverter converter = TypeDescriptor.GetConverter(typeof(System.Web.UI.WebControls.HorizontalAlign));
         writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign).ToLower(CultureInfo.InvariantCulture));
     }
     System.Web.UI.WebControls.VerticalAlign verticalAlign = this.VerticalAlign;
     if (verticalAlign != System.Web.UI.WebControls.VerticalAlign.NotSet)
     {
         TypeConverter converter2 = TypeDescriptor.GetConverter(typeof(System.Web.UI.WebControls.VerticalAlign));
         writer.AddAttribute(HtmlTextWriterAttribute.Valign, converter2.ConvertToString(verticalAlign).ToLower(CultureInfo.InvariantCulture));
     }
 }
 public sealed override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
 {
     string cssClass = string.Empty;
     bool flag = true;
     if (this._owner.IsSet(2))
     {
         cssClass = this._owner.CssClass;
     }
     if (base.RegisteredCssClass.Length != 0)
     {
         flag = false;
         if (cssClass.Length != 0)
         {
             cssClass = cssClass + " " + base.RegisteredCssClass;
         }
         else
         {
             cssClass = base.RegisteredCssClass;
         }
     }
     if (cssClass.Length > 0)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
     }
     if (flag)
     {
         base.GetStyleAttributes(owner).Render(writer);
     }
 }
Exemple #15
0
        public static void addStyleSheet(string css, string key, Page currentPage, WebControl control)
        {
            ControlCollection ctrls = currentPage.Controls;
            if (currentPage.Master != null)
                ctrls = currentPage.Master.Controls;

            foreach (Control ctrl in ctrls)
            {
                if (ctrl.GetType().Name == "HtmlHead")
                {
                    ctrls = ctrl.Controls;
                    break;
                }
            }

            if (key != null)
            {
                foreach (Control ctrl in ctrls)
                {
                    if (ctrl.ID == key)
                        return;
                }
            }

            string url = currentPage.ClientScript.GetWebResourceUrl(control.GetType(), "ESWCtrls.ResEmbed.Styles." + css);
            HtmlLink link = new HtmlLink();
            link.Attributes.Add("type", "text/css");
            link.Attributes.Add("rel", "stylesheet");
            link.Attributes.Add("media", "screen");
            link.Href = url;
            link.ID = key;

            ctrls.Add(new LiteralControl("\n"));
            ctrls.Add(link);
        }
Exemple #16
0
		bool TryEnable(WebControl c, bool enabled)
		{
			if (c == null || c is Button)
				return false;
			c.Enabled = enabled;
			return true;
		}
 public VisibleExtender(bool _visible, WebControl _caller, WebControl _targetControl, string _targetValue)
 {
     visible = _visible;
     callerControl = _caller;
     targetControl = _targetControl;
     targetValue = _targetValue;
 }
Exemple #18
0
 /// <summary>
 /// 設置Selector
 /// </summary>
 /// <param name="ctrlTrigger">控件ID--按鈕</param>
 /// <param name="ctrlCode">控件ID--文本框1</param>
 /// <param name="ctrlName">控件ID--文本框2</param>
 public void SetSelector(WebControl ctrlTrigger, Control ctrlCode, Control ctrlName)
 {
     if (ctrlCode is TextBox) { (ctrlCode as TextBox).Attributes.Add("readonly", "readonly"); }
     if (ctrlName is TextBox) { (ctrlName as TextBox).Attributes.Add("readonly", "readonly"); }
     ctrlTrigger.Attributes.Add("onclick", string.Format("return setSelector('{0}','{1}','{2}')",
         ctrlCode.ClientID, ctrlName.ClientID, Request.QueryString["modulecode"]));
 }
 public AutoFillExtender(AutoFillExtenderXml xml, WebControl target)
 {
     _targetControl = target;
     _type = xml.Type;
     _filterId = xml.FilterId;
     this.Name = xml.Name;
 }
Exemple #20
0
 public static void InitGeneralControlLayout(
     System.Web.UI.WebControls.WebControl MyControl,
     System.Drawing.Color BackColor,
     System.Drawing.Color BorderColor,
     System.Web.UI.WebControls.BorderStyle BorderStyle,
     string AccessKey,
     System.Web.UI.WebControls.Unit BorderWidth,
     string MyCsClass,
     bool visible,
     System.Web.UI.WebControls.Unit Width,
     System.Web.UI.WebControls.Unit Height,
     System.Drawing.Color ForeColor
     )
 {
     MyControl.BackColor   = BackColor;
     MyControl.BorderColor = BorderColor;
     MyControl.BorderStyle = BorderStyle;
     MyControl.AccessKey   = AccessKey;
     MyControl.BorderWidth = BorderWidth;
     MyControl.CssClass    = MyCsClass;
     MyControl.Visible     = visible;
     MyControl.Width       = Width;
     MyControl.Height      = Height;
     MyControl.ForeColor   = ForeColor;
 }
Exemple #21
0
 public static void SetUpEmployeesView(WebControl control, string title)
 {
     ASPxNavBar navBar = (ASPxNavBar)control;
     NavBarGroup employeesGroup = navBar.Groups.First();
     employeesGroup.Items.Clear();
     employeesGroup.Text = title;
 }
Exemple #22
0
        /// <summary>
        /// Appends a CSS class to a control.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="newClass">The new class.</param>
        public static void AppendCssClass(WebControl control, string newClass)
        {
            if (control == null)
                throw new ArgumentNullException("control", "Cannot add a css class to a null control");

            if (newClass == null)
                throw new ArgumentNullException("newClass", "Cannot add a null css class to a control");

            string existingClasses = control.CssClass;
            if (String.IsNullOrEmpty(existingClasses))
            {
                control.CssClass = newClass;
                return;
            }

            string[] classes = existingClasses.Split(' ');
            foreach (string attributeValue in classes)
            {
                if (String.Equals(attributeValue, newClass, StringComparison.Ordinal))
                {
                    //value's already in there.
                    return;
                }
            }
            control.CssClass += " " + newClass;
        }
        internal void SetUpClickableControl( WebControl clickableControl )
        {
            if( resource == null && postBack == null && script == "" )
                return;

            clickableControl.CssClass = clickableControl.CssClass.ConcatenateWithSpace( "ewfClickable" );

            if( resource != null && EwfPage.Instance.IsAutoDataUpdater ) {
                postBack = EwfLink.GetLinkPostBack( resource );
                resource = null;
            }

            Func<string> scriptGetter;
            if( resource != null )
                scriptGetter = () => "location.href = '" + EwfPage.Instance.GetClientUrl( resource.GetUrl() ) + "'; return false";
            else if( postBack != null ) {
                EwfPage.Instance.AddPostBack( postBack );
                scriptGetter = () => PostBackButton.GetPostBackScript( postBack );
            }
            else
                scriptGetter = () => script;

            // Defer script generation until after all controls have IDs.
            EwfPage.Instance.PreRender += delegate { clickableControl.AddJavaScriptEventScript( JsWritingMethods.onclick, scriptGetter() ); };
        }
Exemple #24
0
        public void RenderExpandImage(System.Web.UI.WebControls.WebControl owner, ref TreeView treeView, bool lastItem, int nodeId)
        {
            HtmlImage ExpandImage = new HtmlImage();

            ExpandImage.Src = "node.gif";
            if (!Open)
            {
                if ((LoadOnExpand | Items.Count > 0))
                {
                    ExpandImage.Src = "closed-" + ExpandImage.Src;
                    ExpandImage.Attributes.Add("onClick", treeView.GetPostBackClientEvent("O" + nodeId.ToString()));
                }
            }
            else
            {
                ExpandImage.Src = "open-" + ExpandImage.Src;
                ExpandImage.Attributes.Add("onClick", treeView.GetPostBackClientEvent("O" + nodeId.ToString()));
            }
            if (lastItem)
            {
                ExpandImage.Src = "end-" + ExpandImage.Src;
            }
            ExpandImage.Src = treeView.ImagesFolder + ExpandImage.Src;
            owner.Controls.Add(ExpandImage);
        }
        /// <summary>
        /// Adds the script to the item's attribute collection.
        /// </summary>
        /// <param name="control">The control to modify.</param>
        /// <param name="item">The <see cref="System.Web.UI.WebControls.ListItem"/> to modify.</param>
        /// <param name="attributeName">The attribute to modify.</param>
        /// <param name="script">The script to add.</param>
        public static void AddScriptAttribute(ASP.WebControl control, ASP.ListItem item, string attributeName, string script)
        {
            bool enableCallBack = !(control is ICallbackControl) || ((ICallbackControl)control).EnableCallBack;

            if (enableCallBack)
            {
                string newValue = script;
                string oldValue = (item == null) ? control.Attributes[attributeName] : item.Attributes[attributeName];

                // Append the new script to the old (if one existed)
                if (oldValue != null && oldValue != newValue)
                {
                    newValue = oldValue.Trim().TrimEnd(';') + ";" + script;
                }

                if (item == null)
                {
                    control.Attributes[attributeName] = newValue;
                }
                else
                {
                    item.Attributes[attributeName] = newValue;
                }
            }
        }
        //protected static string ReadCss()
        //{
        //    string res;
        //    string fileName = string.Format("table.css");
        //    string path = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Themes\Default\" + fileName);
        //    using (StreamReader s = new StreamReader(path))
        //    {
        //        res = s.ReadToEnd();
        //    }
        //    return res;
        //}
        public static bool Save(WebControl grid, string path)
        {
            try
            {
                using (StreamWriter s = new StreamWriter(path, false, Encoding.Unicode))
                {
                    Page page = new Page();
                    page.EnableViewState = false;
                    HtmlForm frm = new HtmlForm();
                    frm.Attributes["runat"] = "server";
                    page.Controls.Add(frm);
                    frm.Controls.Add(grid);
                    StringWriter stringWrite = new StringWriter();
                    HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
                    frm.RenderControl(htmlWrite);

                    string start = @"<style>.text { mso-number-format:\@; }</style>";
                    s.Write(start);
                    s.Write(stringWrite.ToString());
                }
                return true;
            }
            catch
            {
                throw;
            }
        }
Exemple #27
0
        private static WebControl BuildContentsControl(BlogEntry entry)
        {
            Panel contentsControl = new Panel();
            WebControl textControl = new WebControl(HtmlTextWriterTag.P);
            textControl.Controls.Add(new LiteralControl(entry.Content));
            contentsControl.Controls.Add(textControl);

            if (entry.Enclosure != null && entry.Enclosure.Uri != null)
            {
                HtmlGenericControl audio = new HtmlGenericControl("audio");
                audio.Attributes.Add("controls", "controls");
                audio.Attributes.Add("src", entry.Enclosure.Uri);
                audio.Attributes.Add("type", "audio/mp3");

                WebControl musicPlayer = new WebControl(HtmlTextWriterTag.Embed);
                musicPlayer.ID = "musicPlayer_" + entry.id;
                musicPlayer.Style.Add(HtmlTextWriterStyle.Width, "400px");
                musicPlayer.Style.Add(HtmlTextWriterStyle.Height, "27px");
                musicPlayer.Style.Add("border", "1px solid rgb(170, 170, 170)");
                musicPlayer.Attributes.Add("src", "http://www.google.com/reader/ui/3523697345-audio-player.swf");
                musicPlayer.Attributes.Add("flashvars", "audioUrl=" + entry.Enclosure.Uri);
                musicPlayer.Attributes.Add("pluginspage", "http://www.macromedia.com/go/getflashplayer");

                audio.Controls.Add(musicPlayer);

                contentsControl.Controls.Add(audio);
            }

            return contentsControl;
        }
Exemple #28
0
        /// <summary>
        /// Builds a web control for a blog post
        /// </summary>
        /// <param name="entry">Blog post to be built into a web control</param>
        /// <returns>A web control presentation of the given blog post</returns>
        public static Control buildBlogPostControl(BlogEntry entry)
        {
            Control blogPostControl = new Control();
            if (entry == null)
                return blogPostControl;

            WebControl titleContentsSeparator = new WebControl(HtmlTextWriterTag.Br);
            titleContentsSeparator.Attributes.Add("clear", "all");

            WebControl contentsFootSeparator = new WebControl(HtmlTextWriterTag.Br);
            contentsFootSeparator.Attributes.Add("clear", "all");

            if (entry.Scheduled)
                blogPostControl.Controls.Add(BuildScheduledBlogPostTitle(entry));
            else
            {
                blogPostControl.Controls.Add(BuildTitleControl(entry));
                blogPostControl.Controls.Add(titleContentsSeparator);
                blogPostControl.Controls.Add(BuildContentsControl(entry));
                blogPostControl.Controls.Add(contentsFootSeparator);
                blogPostControl.Controls.Add(PostFootControl(entry));
            }
            //blogPostControl.Controls.Add(BuildCategoryPanel(entry));

            return blogPostControl;
        }
 /// <summary>
 /// Sets the error CssClass if an error is present.
 /// </summary>
 /// <param name="validator"></param>
 /// <param name="control"></param>
 /// <param name="className"></param>
 internal static void SetError(BaseValidator validator, WebControl control, string className)
 {
     if (validator.IsValid == false)
     {
         AddCssClass(control, className);
     }
 }
        internal ModalWindow( Control parent, Control content, string title = "", PostBack postBack = null, bool open = false )
        {
            control = new Block( new Section( title, content.ToSingleElementArray().Concat( getButtonTable( postBack ) ) ) ) { CssClass = CssElementCreator.CssClass };
            this.open = open;

            EwfPage.Instance.AddEtherealControl( parent, this );
        }
Exemple #31
0
 public static void MakeDirty(WebControl control)
 {
     if (control != null)
     {
         control.CssClass = "dirty";
         control.Focus();
     }
 }
Exemple #32
0
 protected void rpt_board_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     System.Web.UI.WebControls.WebControl ctl = (System.Web.UI.WebControls.WebControl)e.Item.FindControl("lbtnDelBoard");
     if (ctl != null)
     {
         ctl.Attributes["onclick"] = "return confirm('确定删除吗?')";
     }
 }
Exemple #33
0
//			catch(Exception ex)
//			{
//				UDS.Components.Error.Log(ex.ToString());
//				Server.Transfer("../../Error.aspx");
//			}
//			finally
//			{
//				dr_catalog = null;
//				dr_board = null;
//				dr_boardmaster = null;
//			}



        #endregion

        private void rpt_catalog_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            System.Web.UI.WebControls.WebControl ctl = (System.Web.UI.WebControls.WebControl)e.Item.FindControl("btndelcatalog");
            if (ctl != null)
            {
                ctl.Attributes["onclick"] = "return confirm('确定删除吗?')";
            }
        }
        public void RegisterFromResource(WebControl control, Type resourceType, string resourceNamePrefix, string resourceName)
        {
            var cssUrl = control.Page.ClientScript.GetWebResourceUrl(resourceType,
                                                                     resourceNamePrefix + "." + resourceName);

            var cssControl = new Literal {Text = @"<link href=""" + cssUrl + @""" type=""text/css"" rel=""stylesheet"" />"};
            _injectionTarget.Controls.Add(cssControl);
        }
Exemple #35
0
 protected override void SetupControl(WebControl control) {
     var editor = control as ASPxComboBox;
     if (editor != null) {
         editor.ShowImageInEditBox = true;
         editor.SelectedIndexChanged += ExtendedEditValueChangedHandler;
         FillEditor(editor);
     }
 }
        public CascadeListExtender(CascadeListExtenderXml xml, WebControl targetControl, WebControl sourceControl)
        {
            _targetControl = targetControl;
            _sourceControl = sourceControl;
            Name = xml.Name;

            extenderXml = xml;
        }
 internal static void SetControlDisplay( WebControl control, bool visible )
 {
     var c = control;
     if( visible )
         c.Style.Remove( HtmlTextWriterStyle.Display );
     else
         c.Style.Add( HtmlTextWriterStyle.Display, "none" );
 }
Exemple #38
0
        public WebCtrlDecoBase(msWebCtrl.WebControl ctrl, Css.StyleBuilder CssStyleBuilder)
        {
            this.Ctrl         = ctrl;
            Ctrl.DataBinding += new EventHandler(Ctrl_DataBinding);
            Ctrl.PreRender   += new EventHandler(Ctrl_PreRender);

            _CssStyleBuilder = CssStyleBuilder;
        }
        public ValidationExtender(ValidationExtenderXml xml, WebControl targetControl, WebControl callerControl)
        {
            _targetControl = targetControl;
            _callerControl = callerControl;
            Name = xml.Name;

            extenderXml = xml;
        }
Exemple #40
0
 /// <summary>
 /// 控件点击 消息确认提示框
 /// </summary>
 /// <param name="page">当前页面指针,一般为this</param>
 /// <param name="msg">提示信息</param>
 public static void ShowConfirm(System.Web.UI.WebControls.WebControl Control, string msg)
 {
     msg = msg.Replace("'", "\'");
     msg = msg.Replace(")", "");
     msg = msg.Replace("(", "");
     msg = msg.Replace("\n", "\\n");
     //Control.Attributes.Add("onClick","if (!window.confirm('"+msg+"')){return false;}");
     Control.Attributes.Add("onclick", "return confirm('" + msg + "');");
 }
        public static void OpenPopUp(System.Web.UI.WebControls.WebControl opener, string PagePath)
        {
            string clientScript = null;

            //Building the client script- window.open
            clientScript = "window.open('" + PagePath + "')";
            //register the script to the clientside click event of the opener control
            opener.Attributes.Add("onClick", clientScript);
        }
        /// <summary>
        /// Creates a tool tip.
        /// </summary>
        internal ToolTip( Control content, Control targetControl, string title = "", bool sticky = false )
        {
            control = new Block( content );
            this.targetControl = targetControl;
            this.title = title;
            this.sticky = sticky;

            EwfPage.Instance.AddEtherealControl( targetControl, this );
        }
Exemple #43
0
        internal static WebControl CopyStyles(WebControl control, NameValueCollection styles)
        {
            foreach (string key in styles.Keys)
            {
                control.Style.Add(key, styles[key]);
            }

            return control;
        }
Exemple #44
0
        /// <summary>
        /// Removes a CSS class name from a web control.
        /// </summary>
        /// <param name="webControl">The web control.</param>
        /// <param name="className">Name of the class.</param>
        public static void RemoveCssClass(this System.Web.UI.WebControls.WebControl webControl, string className)
        {
            string match = @"\s*\b" + className + "\b";
            string css   = webControl.CssClass;

            if (Regex.IsMatch(css, match, RegexOptions.IgnoreCase))
            {
                webControl.CssClass = Regex.Replace(css, match, "", RegexOptions.IgnoreCase);
            }
        }
Exemple #45
0
 /// <summary>
 /// Metodo per aggiungere un elemnto di Default ad un Controllo DropDownList o ListBox
 /// </summary>
 /// <param name="ctrl">Controllo DropDownList o ListBox</param>
 /// <param name="text">Testo da visualizzare</param>
 /// <param name="Value">Valore nascosto</param>
 protected void AddDefaultItem(System.Web.UI.WebControls.WebControl ctrl, string text, string Value)
 {
     if (ctrl is S_Controls.S_ComboBox || ctrl is  DropDownList)
     {
         ((DropDownList)ctrl).Items.Insert(0, new ListItem(text, Value));
     }
     if (ctrl is S_Controls.S_ListBox || ctrl is  ListBox)
     {
         ((ListBox)ctrl).Items.Insert(0, new ListItem(text, Value));
     }
 }
Exemple #46
0
 /// <summary>
 /// Create a calendar control that extendes the text box.
 /// </summary>
 /// <param name="targetControl">The text box control.</param>
 /// <returns>The calendar control.</returns>
 public static Nequeo.Web.UI.ScriptControl.Calendar CreateCalendarControl(
     System.Web.UI.WebControls.WebControl targetControl)
 {
     // Return the calendar control.
     return(new Nequeo.Web.UI.ScriptControl.Calendar()
     {
         ID = targetControl.ID + "_Calendar",
         Format = "dd/MM/yyyy",
         TargetControlID = targetControl.ID,
         PopupPosition = Nequeo.Web.Common.CalendarPosition.Right
     });
 }
Exemple #47
0
        /// <summary>
        /// Gets the control.
        /// </summary>
        /// <returns>Control with handler.</returns>
        public override Control GetControl()
        {
            LinkButton actionBtn = new LinkButton
            {
                OnClientClick = string.Format(this.RawScript, this.Arguments)
            };

            System.Web.UI.WebControls.WebControl internalSpan = new System.Web.UI.WebControls.WebControl(HtmlTextWriterTag.Span);
            internalSpan.Controls.Add(new Literal
            {
                Text = Translate.Text(DisplayName)
            });

            actionBtn.Controls.Add(internalSpan);
            return(actionBtn);
        }
Exemple #48
0
        /// <summary>
        /// Assign the default web control property with the specified value.
        /// </summary>
        /// <param name="webControl">The web control instance.</param>
        /// <param name="value">The value to assign to the web control.</param>
        /// <param name="type">The web control type.</param>
        /// <returns>The value assign web control.</returns>
        public static System.Web.UI.WebControls.WebControl AssignWebControlValue(
            System.Web.UI.WebControls.WebControl webControl, object value, Type type)
        {
            switch (type.FullName.ToLower())
            {
            case "system.web.ui.webcontrols.checkbox":
                CheckBox checkBox = (CheckBox)webControl;
                checkBox.Checked = (bool)value;
                return(checkBox);

            default:
                TextBox textBox = (TextBox)webControl;
                textBox.Text = value.ToString();
                return(textBox);
            }
        }
Exemple #49
0
        public static void OpenNewWindowOnClick(ref System.Web.UI.WebControls.WebControl ctrl, String strRedirect, String ventanatitle, bool bAddOnReturn)
        {
            if (ctrl == null)
            {
                return;
            }
            String sOnClick = "javascript:url('";

            sOnClick += strRedirect + "', '";
            sOnClick += ventanatitle;
            sOnClick += "',200,200,300,300);";
            if (bAddOnReturn)
            {
                sOnClick += "return false;";
            }
            ctrl.Attributes.Add("onClick", sOnClick);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        AppCode appCode = new AppCode();

        ControlsMethod();
        Cache.Count.ToString();
        Cache["key"] = "value";
        ClientTarget.ToString();
        Page.IsPostBack.ToString();
        Page.IsCallback.ToString();
        Request.Browser.Type.ToString();
        Request.Form.ToString();
        Request.QueryString.ToString();

        Button1.BackColor = Color.Cyan;
        System.Web.UI.WebControls.WebControl webControl = new System.Web.UI.WebControls.WebControl(HtmlTextWriterTag.Base);
    }
Exemple #51
0
 /// <summary>
 /// 绑定枚举
 /// </summary>
 /// <param name="c">控件</param>
 /// <param name="lst">EnumObj list</param>
 /// <param name="defaultValue">默认选中值</param>
 public static void BindEnum(System.Web.UI.WebControls.WebControl c, List <EnumObj> lst, string defaultValue)
 {
     if (null != lst && lst.Count > 0)
     {
         if (c is RadioButtonList)
         {
             RadioButtonList rb = ((RadioButtonList)c);
             rb.DataSource     = lst;
             rb.DataTextField  = "text";
             rb.DataValueField = "value";
             rb.DataBind();
             if (!string.IsNullOrEmpty(defaultValue))
             {
                 rb.SelectedValue = defaultValue;
             }
         }
     }
 }
        /// <summary>
        /// Add a generic callback to the target control.
        /// </summary>
        /// <remarks>The target control is most often the same as the control that is raising the event, but the GridView (for example) is the target for all of it's generated child controls.</remarks>
        private static void AddEventHandler(Control parent, ASP.WebControl control, string eventName, string commandName, string commandArgument, bool causesValidation, string validationGroup, string textDuringCallBack, bool enabledDuringCallBack, string preCallBackFunction, string postCallBackFunction, string callBackCancelledFunction)
        {
            if (!string.IsNullOrEmpty(commandName) || !string.IsNullOrEmpty(commandArgument))
            {
                parent.Page.ClientScript.RegisterForEventValidation(parent.UniqueID, string.Format("{0}${1}", commandName, commandArgument));
            }

            AddScriptAttribute(control, eventName,
                               string.Format(
                                   "javascript:Anthem_Fire(this,event,'{0}','{1}',{2},'{3}','','{4}',{5},{6},{7},{8},true,true);return false;",
                                   parent.UniqueID,
                                   string.IsNullOrEmpty(commandName) && string.IsNullOrEmpty(commandArgument) ? "" : commandName + "$" + commandArgument,
                                   causesValidation ? "true" : "false", validationGroup,
                                   textDuringCallBack, enabledDuringCallBack ? "true" : "false",
                                   string.IsNullOrEmpty(preCallBackFunction) ? "null" : preCallBackFunction,
                                   string.IsNullOrEmpty(postCallBackFunction) ? "null" : postCallBackFunction,
                                   string.IsNullOrEmpty(callBackCancelledFunction) ? "null" : callBackCancelledFunction
                                   )
                               );
        }
Exemple #53
0
        /// <summary>
        /// 增加表的Cell
        /// </summary>
        /// <param name = "ct"></param>
        /// <param name = "strText"></param>
        /// <param name = "strLoc">第一位align属性,第二位颜色属性</param>
        public void AddCell(System.Web.UI.WebControls.WebControl ct, string strText, params string[] strLoc)
        {
            TableCell tbcl = new TableCell();

            tbcl.Controls.Add(ct);

            if (strLoc.Length >= 1)
            {
                tbcl.Attributes["align"] = strLoc[0];
            }
            if (strLoc.Length >= 2)
            {
                tbcl.Attributes["bgcolor"] = strLoc[1];
            }
            if (strLoc.Length >= 3)
            {
                tbcl.Style["width"] = strLoc[2];
                //iRecLength += int.Parse(strLoc[2]);
            }
            tr.Controls.Add(tbcl);
        }
Exemple #54
0
 //ASP.TableCell cell or ASP.GridViewRow row
 private void SetClickEvent(ASP.WebControl row, string commandName, string commandArgument)
 {
     if (!this.AddCallBacks)
     {
         string eventText = commandName + "$" + commandArgument;
         row.Attributes.Add("onclick", this.Page.ClientScript.GetPostBackEventReference(this, eventText));
     }
     else
     {
         string command = (String.IsNullOrEmpty(commandName) && String.IsNullOrEmpty(commandArgument) ? "" : commandName + "$" + commandArgument);
         string script  = String.Format("Anthem_FireCallBackEvent(this,event,'{0}','{1}',{2},'{3}','','{4}',{5},{6},{7},{8},true,true);return false;",
                                        this.UniqueID,
                                        command,
                                        "false",
                                        String.Empty,
                                        base.TextDuringCallBack,
                                        base.EnabledDuringCallBack ? "true" : "false",
                                        (String.IsNullOrEmpty(base.PreCallBackFunction)  ? "null" : base.PreCallBackFunction),
                                        (String.IsNullOrEmpty(base.PostCallBackFunction) ? "null" : base.PostCallBackFunction),
                                        (String.IsNullOrEmpty(base.CallBackCancelledFunction) ? "null" : base.CallBackCancelledFunction));
         Manager.AddScriptAttribute(row, "onclick", script);
     }
 }
Exemple #55
0
 public ResourceControl(string id, WebControls.WebControl control)
 {
     ID      = id;
     Control = control;
 }
Exemple #56
0
    /// <summary>
    /// Create web control for specified field.
    /// </summary>
    private WebControl CreateControlForField(PXFieldSchema f)
    {
        System.Web.UI.WebControls.WebControl ctrl = null;
        switch (f.ControlType)
        {
        case PXSchemaControl.NumberEdit:
            ctrl = new PXNumberEdit();
            ((PXNumberEdit)ctrl).DataField = f.DataField;
            ((PXNumberEdit)ctrl).ValueType = f.DataType;
            ((PXNumberEdit)ctrl).AllowNull = true;
            break;

        case PXSchemaControl.TextEdit:
            ctrl = new PXTextEdit();
            ((PXTextEdit)ctrl).DataField = f.DataField;
            break;

        case PXSchemaControl.CheckBox:
            ctrl = new PXCheckBox();
            ((PXCheckBox)ctrl).DataField = f.DataField;
            break;

        case PXSchemaControl.ComboBox:
            ctrl = new PXDropDown();
            ((PXDropDown)ctrl).DataField = f.DataField;
            ((PXDropDown)ctrl).AllowNull = false;
            break;

        case PXSchemaControl.Selector:
            ctrl = new PXSelector();
            ((PXSelector)ctrl).DataSourceID = ds.ID;
            ((PXSelector)ctrl).DataField    = f.DataField;
            PXFieldState fs = ((RMReportMaint)ds.DataGraph).Report.Cache.GetStateExt(((RMReportMaint)ds.DataGraph).Report.Current, f.DataField) as PXFieldState;
            if (fs != null && !String.IsNullOrWhiteSpace(fs.DescriptionName))
            {
                ((PXSelector)ctrl).TextMode    = TextModeTypes.Search;
                ((PXSelector)ctrl).DisplayMode = ValueDisplayMode.Text;
            }
            else if (fs.ValueField != null && fs.ValueField.ToLower() == "compositekey")
            {
                ((PXSelector)ctrl).CommitChanges = true;
            }
            break;

        case PXSchemaControl.SegmentMask:
            ctrl = new PXSegmentMask();
            ((PXSegmentMask)ctrl).DataMember = f.ViewName;
            break;

        case PXSchemaControl.DateTimeEdit:
            ctrl = new PXDateTimeEdit();
            ((PXDateTimeEdit)ctrl).DataField = f.DataField;
            break;
        }

        if (ctrl != null)
        {
            ctrl.ID = f.DataField;
            ((IFieldEditor)ctrl).DataField = f.DataField;
        }
        return(ctrl);
    }
Exemple #57
0
 /// <summary>
 /// 控件点击 消息确认提示框Control
 /// </summary>
 /// <param name="page">当前页面指针,一般为this</param>
 /// <param name="msg">提示信息</param>
 public static void ShowConfirm(System.Web.UI.WebControls.WebControl Control, string msg)
 {
     //Control.Attributes.Add("onClick","if (!window.confirm('"+msg+"')){return false;}");
     Control.Attributes.Add("onclick", "return confirm('" + msg + "');");
 }
Exemple #58
0
/// <summary>
/// Sets focus to a web control after page load
/// </summary>
/// <param name="control">control client id</param>
    public void DefaultFocus(System.Web.UI.WebControls.WebControl control)
    {
        this.DefaultFocus(control.ClientID, control.ClientID);
    }
Exemple #59
0
/// <summary>
/// Sets focus to a web control after page load
/// </summary>
/// <param name="control">control client id</param>
/// <param name="key">identity key value</param>
    public void DefaultFocus(System.Web.UI.WebControls.WebControl control, string key)
    {
        this.DefaultFocus(control.ClientID, key);
    }
 /// <summary>
 /// 控件点击 消息确认提示框
 /// </summary>
 /// <param name="page">当前页面指针,一般为this</param>
 /// <param name="msg">提示信息</param>
 public static void ShowConfirm(System.Web.UI.WebControls.WebControl Control, string msg)
 {
     Control.Attributes.Add("onclick", "return confirm('" + msg + "');");
 }