Inheritance: IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor, IUrlResolutionService, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor
コード例 #1
0
        public static jquerybasic FindjQuery(Control control)
        {
            jquerybasic jquerybasic1 = null;

            if (control is Page) {
                Page thePage = (Page)control;
                foreach (Control c in thePage.Header.Controls) {
                    if (c is jquerybasic) {
                        jquerybasic1 = (jquerybasic)c;
                        break;
                    } else {
                        jquerybasic1 = FindjQuery(c);
                        if (jquerybasic1 != null) {
                            break;
                        }
                    }
                }
            } else {
                foreach (Control c in control.Controls) {
                    if (c is jquerybasic) {
                        jquerybasic1 = (jquerybasic)c;
                        break;
                    } else {
                        jquerybasic1 = FindjQuery(c);
                        if (jquerybasic1 != null) {
                            break;
                        }
                    }
                }
            }

            return jquerybasic1;
        }
コード例 #2
0
        /*
         * Adds a child control to this control.
         */

        /// <devdoc>
        /// <para>Adds the specified <see cref='System.Web.UI.Control'/> object
        ///    to the collection. The new control is logically added to the end of an ordinal
        ///    index array.</para>
        /// </devdoc>
        public virtual void Add(Control child) {
            // Note: duplication of code with AddAt is deliberate for performance reasons. This is the more common form of the call.

            // Check arguments
            if (child == null)
                throw new ArgumentNullException("child");

            if (_readOnlyErrorMsg != null) {
                throw new HttpException(SR.GetString(_readOnlyErrorMsg ));
            }

            // Make sure we have room
            if (_controls == null) {
                _controls = new Control[_defaultCapacity];
            }
            else if (_size >= _controls.Length) {
                Control[] newArray = new Control[_controls.Length * _growthFactor ];
                Array.Copy(_controls, newArray, _controls.Length);
                _controls = newArray;
            }

            // Add the control
            int index = _size;
            _controls[index] = child;
            _size++;
            _version++;

            // Notify Owner
            _owner.AddedControl(child, index);
        }
コード例 #3
0
        /// <summary>
        /// Reads new values entered by the user for the field
        /// </summary>
        /// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
        /// <param name="configurationValues"></param>
        /// <returns></returns>
        public override string GetEditValue( Control control, Dictionary<string, ConfigurationValue> configurationValues )
        {
            if ( control != null && control is ListControl )
                return ( (ListControl)control ).SelectedValue;

            return null;
        }
コード例 #4
0
        public override void UpdateEditor(N2.ContentItem item, Control editor)
        {
            if (item == null)
                throw new ArgumentNullException("item", "item is null.");
            if (editor == null)
                throw new ArgumentNullException("editor", "editor is null.");

            ListBox lb = (ListBox)editor;
            string currentlySelectedItemsString = (string)item[this.Name] ?? string.Empty;

            if (!string.IsNullOrEmpty(currentlySelectedItemsString))
            {
                string[] currentlySelectedItems = currentlySelectedItemsString.Split(ItemSeperator);
                if (currentlySelectedItems.Length > 0)
                {
                    foreach (string currentItem in currentlySelectedItems)
                    {
                        ListItem listItem = lb.Items.FindByValue(currentItem);

                        if (listItem != null)
                            listItem.Selected = true;
                    }
                }
            }
        }
コード例 #5
0
        private static void BuildFromDirectory(string baseDir, Control level)
        {
            foreach (string idxDir in Directory.GetDirectories(baseDir))
            {
                string dir = idxDir.Replace(baseDir, "");

                // Skipping .svn and similar directories...
                if (dir.IndexOf(".") == 0)
                {
                    continue;
                }
                TreeNode n = new TreeNode {ID = level.ID + dir, Xtra = idxDir, Text = dir};
                level.Controls.Add(n);
                string[] childDirectories = Directory.GetDirectories(idxDir);
                if (childDirectories.Length > 0)
                {
                    // Skipping .svn and similar directories...
                    if (childDirectories.Length == 1)
                    {
                        string tmpDir = childDirectories[0];
                        tmpDir = tmpDir.Substring(tmpDir.LastIndexOf("\\") + 1);
                        if (tmpDir.IndexOf(".") == 0)
                        {
                            continue;
                        }
                    }
                    TreeNodes children = new TreeNodes {ID = "ch" + n.ID};
                    n.Controls.Add(children);
                    BuildFromDirectory(idxDir + "\\", children);
                }
            }
        }
コード例 #6
0
ファイル: Index.aspx.cs プロジェクト: JonathanValle/mixerp
        public void LoadWidgets(IEnumerable<Widget> widgetModels, Control placeholder, TemplateControl page)
        {
            if (placeholder == null)
            {
                return;
            }

            if (page == null)
            {
                return;
            }

            if (widgetModels == null)
            {
                return;
            }

            var groups = widgetModels.OrderBy(x => x.RowNumber).ThenBy(x => x.ColumnNumber).GroupBy(x => new {x.RowNumber});

            foreach (var group in groups)
            {
                foreach (Widget item in group)
                {
                    using (MixERPWidgetBase widget = page.LoadControl(item.WidgetSource) as MixERPWidgetBase)
                    {
                        if (widget != null)
                        {
                            placeholder.Controls.Add(widget);
                            widget.OnControlLoad(widget, new EventArgs());
                        }
                    }
                }
            }
        }
コード例 #7
0
        void GetModulePanel(string Panel, string lang)
        {
            ModulesFrontPanelBSO _module = new ModulesFrontPanelBSO();
            DataTable tb = _module.GetModulesFrontPanelbyPanel(Panel, lang);
            string _path = ResolveUrl("~/") + "Client/Modules/MainHome/";
            Control objControl = new Control();


            if (tb.Rows.Count > 0)
            {
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    //if (tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Left") || tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Right"))
                    //    _path += "Client/Modules/Panel/";
                    //else
                    //    if (tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Main"))
                    //        _path += "Client/Modules/MainHome/";

                    objControl = (Control)this.LoadControl(_path + tb.Rows[i]["ModulesFrontPanel_Url"].ToString());

                    AreaMainPanel.Controls.Add(objControl);
                    ControlParameter(objControl, tb.Rows[i]["ModulesFrontPanel_Title"].ToString(), tb.Rows[i]["ModulesFrontPanel_Icon"].ToString(), tb.Rows[i]["ModulesFrontPanel_Value"].ToString(), Convert.ToInt32(tb.Rows[i]["ModulesFrontPanel_Record"].ToString()));

                }
            }

        }
コード例 #8
0
 public GridViewTemplate(DataControlRowType type, string colNameFr, string colNameDt, Control con)
 {
     templateType = type;
     columnNameFriendly = colNameFr;
     columnNameData = colNameDt;
     control = con;
 }
コード例 #9
0
		public override Control AddTo(Control container, PluginContext context)
		{
			HtmlGenericControl hgc = new HtmlGenericControl("div");
			hgc.Attributes["class"] = "separator";
			container.Controls.Add(hgc);
			return hgc;
		}
コード例 #10
0
ファイル: DroppableZone.cs プロジェクト: nikita239/Aspect
        protected override void CreateItems(Control container)
        {
            if (State.IsFlagSet(ControlPanelState.DragDrop) && (AllowExternalManipulation || CurrentItem == CurrentPage || Find.ClosestPage(CurrentItem) == CurrentPage))
            {
                if (ZoneName.IndexOfAny(new[] {'.', ',', ' ', '\'', '"', '\t', '\r', '\n'}) >= 0) throw new N2Exception("Zone '" + ZoneName + "' contains illegal characters.");

                Panel zoneContainer = AddPanel(this, ZoneName + " dropZone");
				if (CurrentItem.ID != 0 && !CurrentItem.VersionOf.HasValue)
				{
					zoneContainer.Attributes["data-id"] = CurrentItem.ID.ToString();
					zoneContainer.Attributes[PartUtilities.PathAttribute] = CurrentItem.Path;
				}
				else
				{
					zoneContainer.Attributes[PartUtilities.PathAttribute] = Find.ClosestPage(CurrentItem).Path;
					zoneContainer.Attributes["data-versionKey"] = CurrentItem.GetVersionKey();
					zoneContainer.Attributes["data-versionIndex"] = CurrentItem.VersionIndex.ToString();
				}
                zoneContainer.Attributes[PartUtilities.ZoneAttribute] = ZoneName;
                zoneContainer.Attributes[PartUtilities.AllowedAttribute] = PartUtilities.GetAllowedNames(ZoneName, PartsAdapter.GetAllowedDefinitions(CurrentItem, ZoneName, Page.User));
                
                zoneContainer.ToolTip = GetToolTip(GetDefinition(CurrentItem), ZoneName);
                base.CreateItems(zoneContainer);
            }
            else
            {
                base.CreateItems(this);
            }
        }
コード例 #11
0
ファイル: WebValidateBox.cs プロジェクト: san90279/UK_OAS
 private Control GetWebValidateBox(Control ct)
 {
     if (ct is WebValidate)
     {
         return ct;
     }
     else if (ct.HasControls())
     {
         foreach (Control ctchild in ct.Controls)
         {
             if (ctchild is WebValidate)
             {
                 return ctchild;
             }
             else
             {
                 GetWebValidateBox(ctchild);
             }
         }
         return null;
     }
     else
     {
         return null;
     }
 }
コード例 #12
0
		private static void TranslateControlText(Control control)
		{
			IEnumerable<IControlTranslator> translators = GetControlTranslators(control);

			foreach (IControlTranslator translator in translators)
				translator.Translate();
		}
コード例 #13
0
		public override bool UpdateItem(ContentItem item, Control editor)
		{
			TextBox tb = (TextBox)editor;
			string[] rows = tb.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
			for (int i = item.Children.Count - 1; i >= 0; --i)
			{
				int index = Array.FindIndex(rows, delegate(string row)
													  {
														  return row == item.Children[i].Title;
													  }
					);
				if (index < 0)
					Context.Persister.Delete(item.Children[i]);
			}
			for (int i = 0; i < rows.Length; i++)
			{
				ContentItem child = FindChild(item, rows[i]);
				if (child == null)
				{
					child = new Option();
					child.Title = rows[i];
					child.AddTo(item);
				}
				child.SortOrder = i;

				editor.RegisterItemToSave(child);
			}

			return true;
		}
コード例 #14
0
			public void InstantiateIn(Control container)
			{
				Literal l = new Literal();
				l.Text = "<div>";
				l.DataBinding += new EventHandler(this.BindData);
				container.Controls.Add(l);
			}
コード例 #15
0
ファイル: ErrorLabel.cs プロジェクト: JonathanValle/mixerp
        private void CreateErrorLabel(Control container)
        {
            this.errorLabel = new HtmlGenericControl("div");
            this.errorLabel.Attributes.Add("class", "big error");

            container.Controls.Add(this.errorLabel);
        }
コード例 #16
0
		protected override Control AddEditor(Control container)
		{
			var editor = base.AddEditor(container);
			if (string.IsNullOrEmpty(Title))
				AddHelp(container);
			return editor;
		}
コード例 #17
0
 protected override Control AddEditor(Control container)
 {
     TimeRange range = new TimeRange {ID = Name + NameEndRange, StartTitle = StartTitle, StartRequired = StartRequired};
     container.Controls.Add(range);
     range.BetweenText = BetweenText;
     return range;
 }
コード例 #18
0
ファイル: Index.aspx.cs プロジェクト: njmube/mixerp
        public void LoadWidgets(IEnumerable<DefaultWidgetSetupView> widgetModels, Control placeholder, TemplateControl page)
        {
            if (placeholder == null)
            {
                return;
            }

            if (page == null)
            {
                return;
            }

            if (widgetModels == null)
            {
                return;
            }

            foreach (DefaultWidgetSetupView item in widgetModels.OrderBy(x => x.WidgetOrder))
            {
                using (MixERPWidget widget = page.LoadControl(item.WidgetSource) as MixERPWidget)
                {
                    if (widget != null)
                    {
                        placeholder.Controls.Add(widget);
                        widget.OnControlLoad(widget, new EventArgs());
                    }
                }
            }
        }
コード例 #19
0
 public MailMessage CreateMailMessage(string recipients, IDictionary replacements, Control owner)
 {
     if (owner == null)
     {
         throw new ArgumentNullException("owner");
     }
     string body = string.Empty;
     string bodyFileName = this.BodyFileName;
     if (!string.IsNullOrEmpty(bodyFileName))
     {
         string path = bodyFileName;
         if (!UrlPath.IsAbsolutePhysicalPath(path))
         {
             path = UrlPath.Combine(owner.AppRelativeTemplateSourceDirectory, path);
         }
         TextReader reader = new StreamReader(owner.OpenFile(path));
         try
         {
             body = reader.ReadToEnd();
         }
         finally
         {
             reader.Close();
         }
     }
     return this.CreateMailMessage(recipients, replacements, body, owner);
 }
コード例 #20
0
ファイル: pane.cs プロジェクト: CarlSargunar/Umbraco-CMS
        public void addProperty(string Caption, Control C) {
            /*
            tr = new TableRow();
            td = new TableCell();
            td.Text = Caption;
            td.Attributes.Add("width", "15%");
            td.Attributes.Add("valign", "top");
            td.Attributes.Add("class", "propertyHeader");
            tr.Cells.Add(td);
                        
            td = new TableCell();
            td.Attributes.Add("class", "propertyContent");
            td.Controls.Add(C);
            tr.Cells.Add(td);

            tbl.Rows.Add(tr);
            if (!this.Controls.Contains(tbl)) {
                this.Controls.Add(tbl);
            }*/
            PropertyPanel pp = new PropertyPanel();
            pp.Controls.Add(C);
            pp.Text = Caption;

            this.Controls.Add(pp);
        }
コード例 #21
0
		internal RegisteredExpandoAttribute (Control control, string controlId, string name, string value, bool encode) {
			_control = control;
			_name = name;
			_value = value;
			_controlId = controlId;
			_encode = encode;
		}
コード例 #22
0
		public override Control AddTo(ContentItem item, string detailName, Control container)
		{
			Control displayer = (Control)Activator.CreateInstance(ControlType);
			Utility.SetProperty(displayer, ControlPropertyName, item[detailName]);
			container.Controls.Add(displayer);
			return displayer;
		}
コード例 #23
0
        public override Control AddTo(Control container, PluginContext context)
        {
            var selector = context.Engine.Resolve<LanguageGatewaySelector>();
            if (!selector.Enabled || selector.LanguagesPerSite /*avoid showing options that might not be relevant */)
                return null;

            ILanguageGateway gateway = selector.GetAllLanguages();

            HtmlGenericControl div = new HtmlGenericControl("div");
            div.Attributes["class"] = "languages";
            container.Controls.Add(div);

            base.AddTo(div, context);

            foreach (ILanguage language in gateway.GetAvailableLanguages())
            {
                Url url = Engine.ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Globalization/Translate.aspx");
                url = url.AppendQuery("language", language.LanguageCode);
                url = url.AppendQuery(SelectionUtility.SelectedQueryKey + "={selected}");

                HyperLink h = new HyperLink();
                h.ID = language.LanguageCode.Replace('-', '_').Replace(' ', '_');
                h.Target = Targets.Preview;
                h.NavigateUrl = context.Rebase(context.Format(url, true));
                h.CssClass = "templatedurl language";
                h.ToolTip = language.LanguageTitle;
                h.Text = string.Format("<img src='{0}' alt=''/>", Url.ToAbsolute(language.FlagUrl));
                h.Attributes["data-url-template"] = context.Rebase(url);
                div.Controls.Add(h);
            }

            return div;
        }
コード例 #24
0
ファイル: EditableDisplay.cs プロジェクト: brianmatic/n2cms
 protected void AddEditable()
 {
     editable = GetEditable(CurrentItem);
     editor = editable.AddTo(this);
     if (!Page.IsPostBack)
         editable.UpdateEditor(CurrentItem, editor);
 }
コード例 #25
0
ファイル: Utility.cs プロジェクト: vorman/WebStats
        public static bool ControlWasPostedBack(Page page, Control target)
        {
            bool result = false;

            string ctlName = page.Request.Params.Get("__EVENTTARGET");

            if (ctlName != null && ctlName != string.Empty)
            {
                if (ctlName.Contains(target.ID))
                {
                    result = true;
                }
            }
            else
            {
                foreach (string ctl in page.Request.Form)
                {
                    if (ctl.Contains(target.ID))
                    {
                        result = true;
                        break;
                    }
                }
            }

            return result;
        }
コード例 #26
0
ファイル: AudioUrlFieldType.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Returns the field's current value(s)
        /// </summary>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="value">Information about the value</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
        /// <returns></returns>
        public override string FormatValue( Control parentControl, string value, Dictionary<string, ConfigurationValue> configurationValues, bool condensed )
        {
            string videoUrl = value;
            if ( !string.IsNullOrEmpty( videoUrl ) )
            {
                if ( condensed )
                {
                    return videoUrl;
                }
                else
                {
                    string htmlFormat = @"
            <audio
            src='{0}'
            class='img img-responsive js-media-audio'
            controls
            >
            </audio>

            <script>
            Rock.controls.mediaPlayer.initialize();
            </script>
            ";
                    var html = string.Format( htmlFormat, videoUrl );
                    return html;
                }

            }

            // value was null
            return null;
        }
コード例 #27
0
		protected override Label AddLabel(Control container)
		{
			if (string.IsNullOrEmpty(Title))
				return null;
			
			return base.AddLabel(container);
		}
コード例 #28
0
		public override Control AddTo(Control container, PluginContext context)
		{
			var requiredPermission = context.Selected.State == ContentState.Published ? Permission.Publish : Permission.Write;
			if (!context.Engine.SecurityManager.IsAuthorized(context.HttpContext.User, context.Selected, requiredPermission))
				return null;

			if(!ActiveFor(container, context.State)) return null;
			
			if (!context.Selected.VersionOf.HasValue) 
				return base.AddTo(container, context);

			HyperLink hl = new HyperLink();
			hl.Text = GetInnerHtml(context, "{IconsUrl}/cross_orange.png", ToolTip, Title);
			hl.NavigateUrl = Url.Parse("{ManagementUrl}/Content/DiscardPreview.aspx").ResolveTokens()
				.AppendQuery("selectedUrl", context.Selected.Url)
				.AppendQuery(PathData.ItemQueryKey, context.Selected.VersionOf.ID)
				.AppendQuery(PathData.VersionIndexQueryKey, context.Selected.VersionIndex);
			hl.CssClass = "cancel";
			hl.Attributes["onclick"] = "return confirm('Are you certain?');";

			hl.ToolTip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? context.Format("Delete this version", false);

			container.Controls.Add(hl);

			return hl;
		}
コード例 #29
0
 protected void AddLink(Control cssRoot, int InsertAt, HtmlLink link)
 {
     if (string.IsNullOrEmpty(Condition))
     {
         if (InsertAt == -1)
         {
             cssRoot.Controls.Add(link);
         }
         else
         {
             cssRoot.Controls.AddAt(InsertAt, link);
         }
     }
     else
     {
         var openif = new Literal();
         openif.Text = string.Format("<!--[if {0}]>", Condition);
         var closeif = new Literal();
         closeif.Text = "<![endif]-->";
         if (InsertAt == -1)
         {
             cssRoot.Controls.Add(openif);
             cssRoot.Controls.Add(link);
             cssRoot.Controls.Add(closeif);
         }
         else
         {
             //Since we want to add at a specific location, we do this in reverse order
             //this allows us to use the same insertion point
             cssRoot.Controls.AddAt(InsertAt, closeif);
             cssRoot.Controls.AddAt(InsertAt, link);
             cssRoot.Controls.AddAt(InsertAt, openif);
         }
     }
 }
コード例 #30
0
        public ICollection GenerateFields(Control control)
        {
            var itemControl = control as IDataBoundItemControl;
            var containerType = 
                ((!(control is IDataBoundListControl) && !(control is Repeater)) && (control is IDataBoundItemControl)) ?
                ContainerType.Item :
                ContainerType.List;
            var mode = itemControl?.Mode ?? DataBoundControlMode.ReadOnly;

            var columns = _table.GetScaffoldColumns(mode, containerType);
            
            return SortColumns(_table, columns)
                .Select(col => {
                    var field = new DynamicField()
                    {
                        DataField = col.Name,
                        HeaderText = (containerType == ContainerType.List) ? col.ShortDisplayName : col.Name
                    };
                    if (containerType != ContainerType.List)
                    {
                        field.ItemStyle.BorderWidth = 0;
                    }
                    field.ItemStyle.Wrap = false;
                    return field;
                })
                .ToList();
        }
コード例 #31
0
ファイル: Http.cs プロジェクト: markfrance/Recording-Monitor
        /// <summary>
        /// Adds Javascript code to safely set focus on the specified control.
        /// </summary>
        public static void Focus(this Web.UI.Control control, bool safe)
        {
            if (!safe)
            {
                control.Focus();
            }

            var script =
                @"setTimeout(function() {                     
                    var fn = function() { 
                        var control = $get('#CLIENT_ID#'); 
                        if (control && control.focus) { try { control.focus(); } catch (err) { } }
                        try{ Sys.Application.remove_load(fn); } catch (err) { }
                    };
                    Sys.Application.add_load(fn); fn();
                }, 10);".Replace("#CLIENT_ID#", control.ClientID);

            ScriptManager.RegisterStartupScript(control.Page, control.GetType(), control.ClientID + "_SetFocusOnLoad", script, addScriptTags: true);
        }
コード例 #32
0
        private static void execute(IEntityPersistence entity, System.Web.UI.Control parent, bool enabled)
        {
            IViewControlEntity entityControl;

            foreach (System.Web.UI.Control control in parent.Controls)
            {
                if (control.Controls.Count > 0)
                {
                    execute(entity, control, enabled);
                }
                else
                if (control is IViewControlEntity)
                {
                    entityControl = control as IViewControlEntity;

                    if (entityControl.EntitySource == entity.GetType().Name)
                    {
                        entityControl.SetValueToControl(entity);
                        entityControl.Enabled = enabled;
                    }
                }
            }
        }
コード例 #33
0
        public void InstantiateIn(System.Web.UI.Control container)
        {
            Literal lc  = new Literal();
            Image   img = new Image();

            switch (templateType)
            {
            case ListItemType.Header:
                lc.Text = "<B>" + columnName + "</B>";
                container.Controls.Add(lc);
                break;

            case ListItemType.Item:
                img.ID       = columnName + "_img";
                img.Height   = 12;
                img.Width    = 12;
                img.ImageUrl = "~/PURCHASE/Image/view1.gif";

                container.Controls.Add(img);
                container.Controls.Add(lc);
                break;
            }
        }
コード例 #34
0
    protected void clearallcontrols(System.Web.UI.Control parent)
    {
        foreach (System.Web.UI.Control c in parent.Controls)
        {
            if (c is TextBox)
            {
                ((TextBox)(c)).Text = "";
            }
            if (c is RadioButton)
            {
                ((RadioButton)(c)).Checked = false;
            }


            clearallcontrols(c);
        }
        DropDownList1.SelectedIndex = 0;
        //DropDownList2.SelectedIndex = 0;
        //DropDownList3.SelectedIndex = 0;
        MultiView1.ActiveViewIndex = -1;
        GridView1.Visible          = false;
        Button2.Visible            = false;
    }
コード例 #35
0
ファイル: BasePage.cs プロジェクト: ssjylsg/crm
 private void SetReadOnly(System.Web.UI.Control control)
 {
     foreach (System.Web.UI.Control child in control.Controls)
     {
         if (child is TextBox)
         {
             ((TextBox)child).ReadOnly = true;
         }
         if (child is DropDownList)
         {
             ((DropDownList)child).Enabled = false;
         }
         if (child is ICanReadOnly)
         {
             ((ICanReadOnly)child).ReadOnly = true;
         }
         if (child is Button)
         {
             ((Button)child).Enabled = false;
         }
         this.SetReadOnly(child);
     }
 }
コード例 #36
0
        /// <summary>
        /// Reads new values entered by the user for the field (as id)
        /// </summary>
        /// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <returns></returns>
        public override string GetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues)
        {
            ConnectionRequestPicker picker = control as ConnectionRequestPicker;

            if (picker != null)
            {
                int?id = picker.ItemId.AsIntegerOrNull();
                if (id.HasValue)
                {
                    using (var rockContext = new RockContext())
                    {
                        var connectionRequest = new ConnectionRequestService(rockContext).GetNoTracking(id.Value);

                        if (connectionRequest != null)
                        {
                            return(connectionRequest.Guid.ToString());
                        }
                    }
                }
            }

            return(null);
        }
コード例 #37
0
    public void InstantiateIn(System.Web.UI.Control container)
    {
        switch (templateType)
        {
        case DataControlRowType.Header:
            Literal lc = new Literal();
            lc.Text = headName;
            container.Controls.Add(lc);
            break;

        case DataControlRowType.DataRow:

            //TextBox tb = new TextBox();
            //tb.ID = container.ClientID;
            LiteralControl lit = new LiteralControl();
            lit.DataBinding += new EventHandler(DataBinding);
            container.Controls.Add(lit);
            break;

        default:
            break;
        }
    }
コード例 #38
0
ファイル: TreeNode.cs プロジェクト: stjordanis/ra-ajax
        private void CreateSpacers()
        {
            // Finding out how many spacers we need...
            int numSpacers = 0;

            ASP.Control idxParent = this.Parent.Parent;
            while (idxParent is TreeNode)
            {
                numSpacers += 1;
                idxParent   = idxParent.Parent.Parent;
            }

            // Creating our spacer elements...
            _spacers = new WEBCTRLS.Label[numSpacers];

            // Looping through and instantiating our spacers...
            for (int idxNo = 0; idxNo < numSpacers; idxNo++)
            {
                _spacers[idxNo]    = new WEBCTRLS.Label();
                _spacers[idxNo].ID = "spacer" + idxNo;
                Controls.AddAt(0, _spacers[idxNo]);
            }
        }
コード例 #39
0
ファイル: UserControl.cs プロジェクト: thinhtp/liteweb.info
        protected override void OnInit(EventArgs e)
        {
            string path = Control;

            if (path.IndexOf("~") != 0)
            {
                if (!_relative)
                {
                    path = string.Format("{0}/{1}", lw.CTE.Folders.UserControlsFolder, Control);
                }
            }

            if (!path.EndsWith(".ascx"))
            {
                path = path + ".ascx";
            }

            System.Web.UI.Control ctrl = this.Page.LoadControl(path);

            this.Controls.Add(ctrl);

            base.OnInit(e);
        }
コード例 #40
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override System.Web.UI.Control[] CreateChildControls(System.Web.UI.Control parentControl)
        {
            ddlCourses = new RockDropDownList
            {
                ID             = parentControl.ID + "_ddlCourses",
                Label          = "Course",
                DataTextField  = "Name",
                DataValueField = "Id",
                Required       = true
            };
            parentControl.Controls.Add(ddlCourses);

            RockContext   rockContext   = new RockContext();
            CourseService courseService = new CourseService(rockContext);
            var           courses       = courseService.Queryable().OrderBy(c => c.Name).ToList();

            ddlCourses.DataSource = courses;
            ddlCourses.DataBind();

            return(new Control[1] {
                ddlCourses
            });
        }
コード例 #41
0
 protected void clearallcontrols(System.Web.UI.Control parent)
 {
     foreach (System.Web.UI.Control c in parent.Controls)
     {
         if (c is TextBox)
         {
             ((TextBox)(c)).Text = "";
         }
         if (c is RadioButton)
         {
             ((RadioButton)(c)).Checked = false;
         }
         clearallcontrols(c);
     }
     TextArea1.InnerText = "";
     TextArea2.InnerText = "";
     lblMessage.Text     = "";
     DropDownList1.ClearSelection();
     DropDownList2.ClearSelection();
     DropDownList3.ClearSelection();
     DropDownList3.Visible = false;
     btnUpload.Enabled     = true;
 }
コード例 #42
0
    private void DisableControls(System.Web.UI.Control control)
    {
        foreach (System.Web.UI.Control c in control.Controls)
        {
            // Get the Enabled property by reflection.
            Type type = c.GetType();
            System.Reflection.PropertyInfo prop = type.GetProperty("Enabled");

            // Set it to False to disable the control.
            if (prop != null)
            {
                if (type != typeof(System.Web.UI.WebControls.Menu))
                {
                    prop.SetValue(c, false, null);
                }
            }
            // Recurse into child controls.
            if (c.Controls.Count > 0)
            {
                this.DisableControls(c);
            }
        }
    }
コード例 #43
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="Page"></typeparam>
        /// <param name="userControlPath"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static UserControl LoadControl <Page>(string userControlPath, string id) where Page : System.Web.UI.Page, ISelfRenderingPage, new()
        {
            System.Web.UI.Page pageHolder = (System.Web.UI.Page) new Page();

            ResourceManager rm = new ResourceManager(true);

            rm.RenderScripts = ResourceLocationType.None;
            rm.RenderStyles  = ResourceLocationType.None;
            rm.IDMode        = IDMode.Explicit;
            pageHolder.Controls.Add(rm);

            if (!userControlPath.StartsWith("~") && !userControlPath.StartsWith("/") && HttpContext.Current != null && HttpContext.Current.CurrentHandler is System.Web.UI.Page)
            {
                string dir = System.IO.Path.GetDirectoryName(HttpContext.Current.Request.CurrentExecutionFilePath).Replace("\\", "/");
                userControlPath = dir + "/" + userControlPath;
            }

            id = id ?? BaseControl.GenerateID();
            System.Web.UI.Control uc = pageHolder.LoadControl(userControlPath);
            uc.ID = id;

            return((UserControl)uc);
        }
コード例 #44
0
        /// <summary>
        /// Para cada WebControl da collection controls, será atribuído true ou false para a propriedade Enabled.
        /// </summary>
        /// <param name="controls">Lista de controles</param>
        /// <param name="enabled">True para habilitar todos os controles da lista controls; false caso contrário.</param>
        /// <param name="clear">True para limpar todos os controles da lista controls; false caso contrário.</param>
        private static void execute(System.Web.UI.Control parent, bool enabled, bool clear, string entitySource)
        {
            foreach (System.Web.UI.Control control in parent.Controls)
            {
                if (control.Controls.Count > 0)
                {
                    execute(control, enabled, clear, entitySource);
                }
                else
                if (control is IViewControlEntity)
                {
                    if (entitySource == string.Empty || entitySource == (control as IViewControlEntity).EntitySource)
                    {
                        (control as IViewControlEntity).Enabled = enabled;

                        if (clear)
                        {
                            (control as IViewControlEntity).SetValueToControl(null);
                        }
                    }
                }
            }
        }
コード例 #45
0
        public void InstantiateIn(System.Web.UI.Control container)
        {
            switch (templateType)
            {
            case DataControlRowType.Header:

                Literal lc = new Literal();

                lc.Text = columnName;

                container.Controls.Add(lc);

                break;

            case DataControlRowType.DataRow:

                HyperLink lbtn = new HyperLink();

                lbtn.ID   = this.controlID;
                lbtn.Text = columnName;

                if (eh != null)
                {
                    //lbtn.Click += new System.EventHandler(eh);
                }

                //lbtn.DataBinding += new System.EventHandler(lbtn_DataBinding);

                container.Controls.Add(lbtn);

                break;

            default:

                break;
            }
        }
コード例 #46
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            string s = ItemTemplate.ToString();

            switch (cellType)
            {
            case DataControlCellType.DataCell:
                System.Web.UI.Control c = new System.Web.UI.Control();
                ItemTemplate.InstantiateIn(c);
                cell.Controls.Add(c);

                EditWindow                  = new RadWindow();
                EditWindow.Modal            = true;
                EditWindow.VisibleStatusbar = false;
                EditWindow.Height           = 350;
                EditWindow.Width            = 490;
                EditWindow.DestroyOnClose   = false;
                EditWindow.Title            = "Edit Performance Indicator Metrics";
                cell.Controls.Add(EditWindow);
                Control.PreRender += new EventHandler(Control_PreRender);



                break;

            case DataControlCellType.Header:
                if (!string.IsNullOrEmpty(HeaderText))
                {
                    cell.Controls.Add(new LiteralControl(HeaderText + "<br>"));
                }

                EditLink      = new HyperLink();
                EditLink.Text = "Edit";
                cell.Controls.Add(EditLink);
                break;
            }
        }
コード例 #47
0
            //- @InstantiateIn -//
            public void InstantiateIn(System.Web.UI.Control container)
            {
                System.Web.UI.WebControls.PlaceHolder pane = new System.Web.UI.WebControls.PlaceHolder();
                switch (type)
                {
                case ListItemType.Header:
                    pane.Controls.Add(new System.Web.UI.WebControls.Literal {
                        Text = "<ul id=\"" + listCssClass + "\">"
                    });
                    break;

                case ListItemType.Item:
                    System.Web.UI.WebControls.Literal literal = new System.Web.UI.WebControls.Literal();
                    literal.DataBinding += new EventHandler(delegate(Object sender, EventArgs ea)
                    {
                        IDataItemContainer item = (IDataItemContainer)container;
                        String url        = DataBinder.Eval(item.DataItem, "Url").ToString();
                        String title      = DataBinder.Eval(item.DataItem, "Title").ToString();
                        String entryCount = DataBinder.Eval(item.DataItem, "EntryCount").ToString();
                        //+
                        literal.Text = @"<li><a href=""{Url}"">{Title} ({EntryCount})</a></li>"
                                       .Replace("{Url}", url)
                                       .Replace("{Title}", title)
                                       .Replace("{EntryCount}", entryCount);
                    });
                    pane.Controls.Add(literal);
                    break;

                case ListItemType.Footer:
                    pane.Controls.Add(new System.Web.UI.WebControls.Literal {
                        Text = "</ul>"
                    });
                    break;
                }
                //+
                container.Controls.Add(pane);
            }
コード例 #48
0
    public void InstantiateIn(System.Web.UI.Control container)
    {
        PlaceHolder ph     = new PlaceHolder();
        TextBox     oCrit1 = new TextBox();

        oCrit1.ID       = "item";
        oCrit1.Width    = 420;
        oCrit1.ReadOnly = true;

        switch (templateType)
        {
        case ListItemType.Header:
            //ph.Controls.Add(new LiteralControl("<td runat='server'><span style='width: 150px;'>"));
            //ph.Controls.Add(new LiteralControl("<td><table border=\"0\"><tbody><tr>"));
            break;

        case ListItemType.Item:
            ph.Controls.Add(new LiteralControl("<td runat='server'>"));
            ph.Controls.Add(oCrit1);
            ph.Controls.Add(new LiteralControl("</td>"));
            ph.DataBinding += new EventHandler(Item_DataBinding);
            break;

        case ListItemType.AlternatingItem:
            ph.Controls.Add(new LiteralControl("<td runat='server'>"));
            ph.Controls.Add(oCrit1);
            ph.Controls.Add(new LiteralControl("</td>"));
            ph.DataBinding += new EventHandler(Item_DataBinding);
            break;

        case ListItemType.Footer:
            //ph.Controls.Add(new LiteralControl("</span></td>"));
            //ph.Controls.Add(new LiteralControl("</tr></tbody></table></td>"));
            break;
        }
        container.Controls.Add(ph);
    }
コード例 #49
0
ファイル: MyChildren.cs プロジェクト: rpwillis/mlg
        public void InstantiateIn(System.Web.UI.Control container)
        {
            PlaceHolder placeHolder = new PlaceHolder();

            if (_templateType == ListItemType.Item)
            {
                HtmlTableRow  row  = new HtmlTableRow();
                HtmlTableCell cell = new HtmlTableCell("td");
                cell.Width = "100%";

                ImageButton childImage = new ImageButton();
                childImage.ID = "img";
                Unit imageWidth = new Unit("60px");
                childImage.Width = imageWidth;
                Unit imageHieght = new Unit("75px");
                childImage.Height      = imageHieght;
                childImage.BorderStyle = BorderStyle.Double;
                childImage.CssClass    = "ms-quickLaunch";


                childImage.Click += new ImageClickEventHandler(ChildImage_Clicked);

                Label childLabel = new Label();
                childLabel.ID = "lbl";

                cell.Controls.Add(childImage);
                cell.Controls.Add(new LiteralControl("<br>"));
                cell.Controls.Add(childLabel);
                cell.Controls.Add(new LiteralControl("<br>"));
                cell.Controls.Add(new LiteralControl("<br>"));
                row.Cells.Add(cell);

                placeHolder.Controls.Add(row);
                placeHolder.DataBinding += new EventHandler(PlaceHolder_DataBinding);
            }
            container.Controls.Add(placeHolder);
        }
コード例 #50
0
ファイル: Menu.cs プロジェクト: stjordanis/ra-ajax
 internal void RollUpAllExceptThis(MenuItems menuItems, ASP.ControlCollection cols)
 {
     foreach (ASP.Control idx in cols)
     {
         if (idx is MenuItems)
         {
             MenuItems items = idx as MenuItems;
             if (!items.Expanded)
             {
                 continue;
             }
             bool        isParent = false;
             ASP.Control idxCtrl  = menuItems;
             while (idxCtrl != null && !(idxCtrl is Menu))
             {
                 if (idxCtrl == items)
                 {
                     isParent = true;
                     break;
                 }
                 idxCtrl = idxCtrl.Parent;
             }
             if (!isParent)
             {
                 items.Expanded = false;
                 items.RollUp();
             }
             else
             {
                 foreach (ASP.Control idxInner in idx.Controls)
                 {
                     RollUpAllExceptThis(menuItems, idxInner.Controls);
                 }
             }
         }
     }
 }
コード例 #51
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override System.Web.UI.Control[] CreateChildControls(System.Web.UI.Control parentControl)
        {
            var groupTypePicker = new GroupTypePicker();

            groupTypePicker.ID                    = parentControl.ID + "_groupTypePicker";
            groupTypePicker.Label                 = "Group Type";
            groupTypePicker.GroupTypes            = new GroupTypeService(new RockContext()).Queryable().OrderBy(a => a.Order).ThenBy(a => a.Name).ToList();
            groupTypePicker.SelectedIndexChanged += groupTypePicker_SelectedIndexChanged;
            groupTypePicker.AutoPostBack          = true;
            parentControl.Controls.Add(groupTypePicker);

            int?selectedGroupTypeId = parentControl.Page.Request.Params[groupTypePicker.UniqueID].AsIntegerOrNull();

            groupTypePicker.SelectedGroupTypeId = selectedGroupTypeId;

            var cblRole = new RockCheckBoxList();

            cblRole.Label = "with Group Role(s)";
            cblRole.ID    = parentControl.ID + "_cblRole";
            parentControl.Controls.Add(cblRole);

            PopulateGroupRolesCheckList(groupTypePicker.SelectedGroupTypeId ?? 0, cblRole);

            RockDropDownList ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.ID       = parentControl.ID + "_ddlGroupMemberStatus";
            ddlGroupMemberStatus.Label    = "with Group Member Status";
            ddlGroupMemberStatus.Help     = "Select a specific group member status only include to only show true for group members with that status. Leaving this blank will return true for all members.";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            parentControl.Controls.Add(ddlGroupMemberStatus);

            return(new Control[3] {
                groupTypePicker, cblRole, ddlGroupMemberStatus
            });
        }
コード例 #52
0
 public void InstantiateIn(System.Web.UI.Control container)
 {
     if (index == tabCount - 1)
     {
         ASPxButton new_btn = new ASPxButton();
         new_btn.ID = "newBtn" + container.ID;
         container.Controls.Add(new_btn);
         new_btn.Width                  = 100;
         new_btn.Height                 = 25;
         new_btn.Text                   = "Open New Tab";
         new_btn.AutoPostBack           = false;
         new_btn.ClientSideEvents.Click = "function(s, e) { createNewTab(); }";
     }
     else
     {
         ASPxButton close_btn = new ASPxButton();
         close_btn.ID = "closeBtn" + container.ID;
         container.Controls.Add(close_btn);
         close_btn.ImageUrl               = "~/Images/Close.png";
         close_btn.ImagePosition          = DevExpress.Web.ASPxClasses.ImagePosition.Right;
         close_btn.AutoPostBack           = false;
         close_btn.ClientSideEvents.Click = "function(s, e) { closeActiveTab(); }";
     }
 }
コード例 #53
0
        protected void shoppingCartProductList_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            System.Web.UI.Control             control = e.Item.Controls[0];
            System.Web.UI.WebControls.TextBox textBox = (System.Web.UI.WebControls.TextBox)control.FindControl("txtBuyNum");
            System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)control.FindControl("litSkuId");
            int num;

            if (!int.TryParse(textBox.Text, out num) || textBox.Text.IndexOf(".") != -1)
            {
                this.ShowMessage("购买数量必须为整数", false);
            }
            else
            {
                if (num <= 0)
                {
                    this.ShowMessage("购买数量必须为大于0的整数", false);
                }
                else
                {
                    if (e.CommandName == "updateBuyNum")
                    {
                        if (ShoppingCartProcessor.GetSkuStock(literal.Text.Trim()) < num)
                        {
                            this.ShowMessage("该商品库存不够", false);
                            return;
                        }
                        ShoppingCartProcessor.UpdateLineItemQuantity(literal.Text, num);
                    }
                    if (e.CommandName == "delete")
                    {
                        ShoppingCartProcessor.RemoveLineItem(literal.Text);
                    }
                    this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("shoppingCart"), true);
                }
            }
        }
コード例 #54
0
        /// <summary>
        /// Reads new values entered by the user for the field ( as Guid )
        /// </summary>
        /// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <returns></returns>
        public override string GetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues)
        {
            GroupTypeGroupPicker groupTypeGroupPicker = control as GroupTypeGroupPicker;

            if (groupTypeGroupPicker != null)
            {
                var rockContext = new RockContext();

                Guid?groupTypeGuid = null;
                Guid?groupGuid     = null;
                if (groupTypeGroupPicker.GroupTypeId.HasValue)
                {
                    var groupType = new GroupTypeService(rockContext).Get(groupTypeGroupPicker.GroupTypeId.Value);
                    if (groupType != null)
                    {
                        groupTypeGuid = groupType.Guid;
                    }
                }

                if (groupTypeGroupPicker.GroupId.HasValue)
                {
                    var group = new GroupService(rockContext).Get(groupTypeGroupPicker.GroupId.Value);
                    if (group != null)
                    {
                        groupGuid = group.Guid;
                    }
                }

                if (groupTypeGuid.HasValue || groupGuid.HasValue)
                {
                    return(string.Format("{0}|{1}", groupTypeGuid, groupGuid));
                }
            }

            return(null);
        }
コード例 #55
0
 /// <summary>
 /// Creates elements based on the fields in a database.
 /// Optionally, the elements are enclosed in a from with ID 'form_[formID]'.
 /// </summary>
 /// <param name="appID">The appID on which these controls are based.</param>
 /// <param name="cntlContainer">The container that contains these controls</param>
 /// <param name="dctDefaultOverride">A dictionary that maps the default value given in the database
 /// with the value to use as an override</param>
 /// <param name="uid">A unique identified to append to the control IDs of the generated controls.
 /// You will need this if you are calling this method several times to generate similar output one page.
 /// (One recommended value for thie Unique ID is the Database ID).</param>
 /// <param name="cntlDisplayStyle"></param>
 /// <param name="blElementsInLine">Set false to allow displaying all elements in line (no line breaks)</param>
 /// <param name="blRunAtServer">When TRUE, includes runat=server as a property of all controls</param>
 public static void GenerateControlsFromDatabase(int appID, System.Web.UI.Control cntlContainer,
                                                 Dictionary <string, string> dctDefaultOverride = null, string uid = "", int cntlDisplayStyle = -1,
                                                 Boolean blElementsInLine = false, Boolean blRunAtServer           = false)
 {
     try
     {
         if (dctDefaultOverride == null)
         {
             dctDefaultOverride = new Dictionary <string, string>();
         }
         SqlCommand          cmd   = new SqlCommand();
         clsDB               myDB  = new clsDB();
         ControlCollection   cntls = new ControlCollection(cntlContainer);
         List <SqlParameter> ps    = new List <SqlParameter>();
         ps.Add(new SqlParameter("@" + DBK.fkAPPID, appID));
         using (myDB.OpenConnection())
         {
             using (SqlDataReader dR = (SqlDataReader)myDB.ExecuteSP(DBK.SP.spGETWEBDISPLAYFIELDINFO,
                                                                     ps,
                                                                     clsDB.SPExMode.READER,
                                                                     ref cmd)
                    )
             {
                 if ((dR != null) && (dR.HasRows))
                 {
                     CustomCode x = new CustomCode();
                     x.ConstructInputControls(dR, cntlContainer, dctDefaultOverride, uid, cntlDisplayStyle,
                                              blElementsInLine, blRunAtServer);
                 }
             }
         }
     } catch (Exception ex)
     {
         cntlContainer.Controls.Add(renderLiteralControlError(ex, ""));
     }
 }
コード例 #56
0
ファイル: State.cs プロジェクト: QYFS2018/VC2
 /// <summary>
 ///	Find control by control id from a control container.
 ///	<code>
 ///	TextBox txt_name = (TextBox)State.FindControl("txt_name",this);
 ///	</code>
 /// </summary>
 /// <param name="controlId">control id to find.</param>
 /// <param name="control">control container.</param>
 /// <returns>The result control.</returns>
 public System.Web.UI.Control FindControl(string controlId, System.Web.UI.Control control)
 {
     System.Web.UI.Control _result = null;
     foreach (System.Web.UI.Control _control in control.Controls)
     {
         if (_control.ID == controlId)
         {
             _result = _control;
             break;
         }
         else
         {
             if (_control.HasControls())
             {
                 _result = FindControl(controlId, _control);
                 if (_result != null)
                 {
                     break;
                 }
             }
         }
     }
     return(_result);
 }
コード例 #57
0
ファイル: DownLoad.aspx.cs プロジェクト: yangningyuan/yny_003
        //这种方式导出的不是标准的Excel格式,不能再次导入,要修改,暂时不做修改
        public void ExportByApplication(System.Web.UI.Control ctl, string fileName)
        {
            string style = @"<style type='text/css'> .text { mso-number-format:\@; } </style> ";

            Response.ClearContent();
            Response.Charset = "GB2312";

            //  Response.ContentEncoding = System.Text.Encoding.UTF8;

            //Response.ContentType = "application/ms-excel";
            Response.ContentType     = "application/vnd.ms-excel ";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
            Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=GB2312\">");
            if (Request.Browser.Browser.ToLower() == "ie")
            {
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + "" + HttpUtility.UrlEncode(fileName + ".xls", Encoding.UTF8));
            }
            else
            {
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
            }

            ctl.Page.EnableViewState = false;

            System.IO.StringWriter tw = new System.IO.StringWriter();

            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);

            ctl.RenderControl(hw);

            Response.Write(style);

            Response.Write(tw.ToString());

            Response.End();
        }
コード例 #58
0
ファイル: workflow.cs プロジェクト: bhur7621/app-asp-0603
        ///////////////////////////////////////////////////////////////////////
        // Returns an HTMLControl or WebControl by its id.
        public static Control find_control(ControlCollection controls, string id)
        {
            foreach (System.Web.UI.Control c in controls)
            {
                if (c.ID == id)
                {
                    return(c);
                }
                else
                {
                    if (c.Controls.Count > 0)
                    {
                        System.Web.UI.Control c2 = null;
                        c2 = find_control(c.Controls, id);
                        if (c2 != null)
                        {
                            return(c2);
                        }
                    }
                }
            }

            return(null);
        }
コード例 #59
0
        public static void DisableAll(System.Web.UI.Control oMe, string strRole_id)
        {
            int cnt = oMe.Controls.Count;

            for (int i = 0; i < cnt; i++)
            {
                if ((oMe.Controls[i].GetType().ToString() == "System.Web.UI.WebControls.TextBox"))
                {
                    ((System.Web.UI.WebControls.TextBox)oMe.Controls[i]).Enabled = false;
                }
                else if ((oMe.Controls[i].GetType().ToString() == "System.Web.UI.WebControls.LinkButton"))
                {
                    ((System.Web.UI.WebControls.LinkButton)oMe.Controls[i]).Enabled = false;
                }
                else if ((oMe.Controls[i].GetType().ToString() == "System.Web.UI.WebControls.DropDownList"))
                {
                    ((System.Web.UI.WebControls.DropDownList)oMe.Controls[i]).Enabled = false;
                }
                else if ((oMe.Controls[i].GetType().ToString() == "System.Web.UI.WebControls.Button"))
                {
                    ((System.Web.UI.WebControls.Button)oMe.Controls[i]).Enabled = false;
                }
                else if ((oMe.Controls[i].GetType().ToString() == "System.Web.UI.WebControls.CheckBoxList"))
                {
                    ((System.Web.UI.WebControls.CheckBoxList)oMe.Controls[i]).Enabled = false;
                }
                else if ((oMe.Controls[i].GetType().ToString() == "System.Web.UI.WebControls.RadioButtonList"))
                {
                    ((System.Web.UI.WebControls.RadioButtonList)oMe.Controls[i]).Enabled = false;
                }
                if (oMe.Controls[i].HasControls())
                {
                    DisableAll(oMe.Controls[i], strRole_id);
                }
            }
        }
コード例 #60
0
ファイル: AuthenticationPage.cs プロジェクト: yonass/ASUC2
    public static System.Web.UI.Control GetPostBackControl(Page page)
    {
        System.Web.UI.Control control = null;

        string ctrlname = page.Request.Params.Get("__EVENTTARGET");

        if (ctrlname != null && ctrlname != string.Empty)
        {
            control = page.FindControl(ctrlname);
        }
        else
        {
            foreach (string ctl in page.Request.Form)
            {
                System.Web.UI.Control c = page.FindControl(ctl);
                if (c is System.Web.UI.WebControls.Button)
                {
                    control = c;
                    break;
                }
            }
        }
        return(control);
    }