Exemplo n.º 1
0
 public void LimpiarControles(ControlCollection controles)
 {
     foreach (Control control in controles)
     {
         if (control is TextBox)
         {
             ((TextBox)control).Text = string.Empty;
         }
         else if (control is DropDownList)
         {
             ((DropDownList)control).ClearSelection();
         }
         else if (control is RadioButtonList)
             ((RadioButtonList)control).ClearSelection();
         else if (control is CheckBoxList)
             ((CheckBoxList)control).ClearSelection();
         else if (control is RadioButton)
             ((RadioButton)control).Checked = false;
         else if (control is CheckBox)
             ((CheckBox)control).Checked = false;
         else if (control is GridView)
             ((GridView)control).DataBind();
         else if (control.HasControls())
             //Esta linea detécta un Control que contenga otros Controles
             //Así ningún control se quedará sin ser limpiado.
             LimpiarControles(control.Controls);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 找一个合适的位置来放置样式表。
        /// </summary>
        /// <param name="controls">来自Header.Controls</param>
        /// <returns></returns>
        /// <remarks>
        /// CSS样式表通常有特定的加载顺序。为了防止css顺序混乱,需要采取一些特殊手法。
        /// 原则:1、建议link引用样式表应出现在任何title和meta元素之后。
        /// 2、必须首先加载的样式表,请为link使用topmost=""属性,并且顺序出现,不能间隔。
        /// 3、任何style和script元素应出现在link元素之后。
        /// </remarks>
        private static int FindProperlyPosition(ControlCollection controls)
        {
            int k = 0;
            Control ctrl;
            for (; k < controls.Count; k++)
            {
                ctrl = controls[k];
                if (ctrl is HtmlLink)
                {
                    HtmlLink link = (HtmlLink)ctrl;
                    if (string.Compare(link.Attributes["rel"], "stylesheet", true) == 0 || ((HtmlLink)ctrl).Attributes["type"] == "text/css")
                    {
                        if (link.Attributes["topmost"] == null)
                        {
                            break;
                        }
                    }
                }
                else if (ctrl is LiteralControl && (System.Text.RegularExpressions.Regex.IsMatch(((LiteralControl)ctrl).Text, "<script ") || System.Text.RegularExpressions.Regex.IsMatch(((LiteralControl)ctrl).Text, "<style ")))
                {
                    break;
                }
            }

            return k;
        }
Exemplo n.º 3
0
        public override ControlCollection GetControls(DataGridCommandEventArgs e)
        {
            DataGrid grid = Grid;
            ControlCollection controls = new ControlCollection(grid);
            foreach (TableCell cell in e.Item.Cells)
            {
                for (int i = 0; i < cell.Controls.Count; i++)
                    controls.Add(cell.Controls[i]);
            }

            /*
            // What the scripts usually do, but our EDITOR_CELL is null.
            const int EDITOR_CELL = 8;
            TableCell o = e.Item.Cells[EDITOR_CELL];
            DropDownList r = (DropDownList) o.FindControl(App.EDITOR);
            controls.Add(r);
            object o = e.Item.FindControl(App.EDITOR);

            // The template is in the DataGrid, just not in the event
            TableRow item = grid.Items[1];
            foreach (TableCell cell in item.Cells)
            {
                for (int i = 0; i < cell.Controls.Count; i++)
                    controls.Add(cell.Controls[i]);
            }
            */

            return controls;
        }
        public void BuildExportControls(ControlCollection controls, System.Web.UI.Page page)
        {
            if (controls == null) 
                throw new ArgumentNullException("controls");
            if (page == null) 
                throw new ArgumentNullException("page");

            var isMessageAdded = controls.Contains(ErrorMessage);
            if (!isMessageAdded)
            {
                controls.Add(ErrorMessage);
                controls.Add(FeedbackMessage);
            }
                

            CurrentColllection = controls;

            ExportButton = UIControls.CreateExportPortletButton();
            ExportButton.Click += new EventHandler(ExportButton_Click);

            PortletList = GetPortletList(page);

            var exportPanel = new Panel();
            exportPanel.ID = "ExportControlPanels";
            exportPanel.GroupingText = "Export";


            exportPanel.Controls.Add(UIControls.CreateLineBreak());
            exportPanel.Controls.Add(PortletList);
            exportPanel.Controls.Add(ExportButton);

            controls.Add(exportPanel);
        }
        public void BuildImportControls(ControlCollection controls, System.Web.UI.Page page)
        {
            if (controls == null)
                throw new ArgumentNullException("controls");
            if (page == null) 
                throw new ArgumentNullException("page");

            var isMessageAdded = controls.Contains(ErrorMessage);
            if (!isMessageAdded)
            {
                controls.Add(ErrorMessage);
                controls.Add(FeedbackMessage);
            }
            CurrentColllection = controls;

            ImportButton = UIControls.CreateImportButton();
            ImportButton.Click += new EventHandler(ImportButton_Click);

            ImportTextBox = UIControls.CreateImportTextArea();
            ImportZoneList = GetZoneList(page);

            var importPanel = new Panel();
            importPanel.ID = "ImportControlsPanel";
            importPanel.GroupingText = "Import";


            importPanel.Controls.Add(UIControls.CreateLineBreak());
            importPanel.Controls.Add(ImportZoneList);
            importPanel.Controls.Add(UIControls.CreateLineBreak());
            importPanel.Controls.Add(ImportTextBox);
            importPanel.Controls.Add(UIControls.CreateLineBreak());
            importPanel.Controls.Add(ImportButton);
            controls.Add(importPanel);
        }
Exemplo n.º 6
0
        protected override void CreateContent(System.Web.UI.Control NamingContainer, System.Web.UI.ControlCollection content)
        {
            content.Add(new Label()
            {
                ID      = "lblZeilenNr",
                Text    = "0",
                Visible = false
            });

            content.Add(new Button()
            {
                ID               = "btnUpdate",
                Text             = "[+]",
                Width            = new Unit(30, UnitType.Pixel),
                ToolTip          = "Änderungen in Datenbank sichern",
                CausesValidation = this.CausesValidation,
                ValidationGroup  = this.ValidationGroup,
                CommandName      = "Update"
            });

            content.Add(new Button()
            {
                ID               = "btnCancel",
                Text             = " / ",
                Width            = new Unit(30, UnitType.Pixel),
                ToolTip          = "Keine Änderungen in der Datenbank sichern",
                CausesValidation = this.CausesValidation,
                ValidationGroup  = this.ValidationGroup,
                CommandName      = "Cancel"
            });
        }
Exemplo n.º 7
0
 public static void SetEmptyFormControls(ControlCollection ChildCtrls)
 {
     foreach (Control Ctrl in ChildCtrls)
     {
         if (Ctrl is TextBox)
             ((TextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadComboBox)
             ((RadComboBox)Ctrl).SelectedValue = string.Empty;
         else if (Ctrl is Label)
             ((Label)Ctrl).Text = string.Empty;
         else if (Ctrl is RadNumericTextBox)
             ((RadNumericTextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadMaskedTextBox)
             ((RadMaskedTextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadTextBox)
             ((RadTextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadDatePicker)
             ((RadDatePicker)Ctrl).SelectedDate = null;
         else if (Ctrl is VVTextBox)
             ((VVTextBox)Ctrl).SetTextDefault("");
         else if (Ctrl is VVNumberBox)
             ((VVNumberBox)Ctrl).SetTextDefault("");
         else if (Ctrl is VVDatePicker)
             ((VVDatePicker)Ctrl).SetTextDefault("");
         else
             SetEmptyFormControls(Ctrl.Controls);
     }
 }
 public static void InsertOnLoadCode(ControlCollection controls, string method)
 {
     foreach (Control control in controls)
      {
     LiteralControl literal = control as LiteralControl;
     if (literal != null)
     {
        int bodyPos = literal.Text.IndexOf(bodyTag);
        if (bodyPos > -1)
        {
           int onloadPos = literal.Text.IndexOf(onloadScript, bodyPos);
           if (onloadPos > -1)
           {
              literal.Text = literal.Text.Insert(onloadPos + onloadScript.Length, method);
           }
           else
           {
              literal.Text =
                 literal.Text.Insert(bodyPos + bodyTag.Length, string.Format(" onload='{0}'", method));
           }
           break;
        }
     }
      }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Create a new test, or load an existing one.
        /// </summary>
        /// <param name="testName"></param>
        /// <param name="alternatives"></param>
        /// <returns></returns>
        public Experiment GetOrCreateTest(string testName, ControlCollection alternatives)
        {
            SerializableDictionary<string, Experiment> tests = GetTests();
            Experiment test;
            if (tests.ContainsKey(testName))
            {
                test = tests[testName];
            }
            else
            {
                string[] altNames = new string[alternatives.Count];
                for (int a = 0; a < alternatives.Count; a++)
                {
                    Alternative alt = (Alternative)alternatives[a];
                    if (!String.IsNullOrEmpty(alt.Name))
                    {
                        altNames[a] = alt.Name;
                    }
                    else
                    {
                        altNames[a] = "Alternative " + (a + 1);
                    }
                }

                test = new Experiment(testName, altNames);
                tests.Add(testName, test);

                SaveTests(tests);
            }

            return test;
        }
 public void beforTest()
 {
     mockery = new Mockery();
     view = mockery.NewMock<IKeyboardView>();
     presenter = new KeyboardPresenter(view);
     keypad = new ControlCollection(new Panel());
     configuration = new Dictionary<string, bool>();
 }
        public static void InitBookmarkingPage(ControlCollection c)
        {
            var provider = new BookmarkingScriptProvider();

            BookmarkingSettings.ModuleId = BookmarkingConst.BookmarkingId;

            c.Add(provider);
        }
 public static void SetBookmarkingActions(ControlCollection c)
 {
     var actions = GetBookmarkingActions();
     if (0 < actions.Controls.Count)
     {
         c.Add(actions);
     }
 }
 public static void SetBookmarkInfoActionsAndNavigation(ControlCollection c)
 {
     var actions = GetBookmarkInfoActions();
     if (0 < actions.Controls.Count)
     {
         c.Add(actions);
     }
     SetBookmarkingNavigation(c);
 }
Exemplo n.º 14
0
		public static bool UpdateBreadCrumb(ControlCollection ctrls, string ForumBread)
		{
			if (string.IsNullOrEmpty(ForumBread))
			{
				return true;
			}
			string[] bcText = ForumBread.Split('|');
			try
			{
				foreach (Control ctrl in ctrls)
				{
					if (ctrl is DotNetNuke.UI.Skins.SkinObjectBase && ctrl.TemplateControl.AppRelativeVirtualPath != null)
					{
						if (ctrl.TemplateControl.AppRelativeVirtualPath.ToLowerInvariant().Contains("breadcrumb.ascx"))
						{
							object o = ctrl.GetType().GetProperty("Separator").GetValue(ctrl, BindingFlags.Public | BindingFlags.NonPublic, null, null, null);
							object cssObject = ctrl.GetType().GetProperty("CssClass").GetValue(ctrl, BindingFlags.Public | BindingFlags.NonPublic, null, null, null);
							string css = "SkinObject";
							if (cssObject != null)
							{
								if (! (string.IsNullOrEmpty(cssObject.ToString())))
								{
									css = cssObject.ToString();
								}
							}
                            string sText = string.Empty;
                            if (o != null)
                            {
                                sText = o.ToString();
                            }
							
							string sBread = string.Empty;
							foreach (string s in bcText)
							{
								if (! (string.IsNullOrEmpty(s)))
								{
									var newValue = s.Replace("<a ", "<a class=\"" + css + "\" ");
                                    sBread += sText + newValue;
								}
							}
							((System.Web.UI.WebControls.Label)(ctrl.FindControl("lblBreadCrumb"))).Text += sBread;
							break;
						}
					}
					if (ctrl.Controls.Count > 0)
					{
						UpdateBreadCrumb(ctrl.Controls, ForumBread);
					}
				}
				return true;
			}
			catch (Exception ex)
			{
				return false;
			}
		}
Exemplo n.º 15
0
        public static DataTable GenerateFieldList(ControlCollection controls)
        {
            DataTable data = new DataTable();
            data.Columns.Add("Field_ID");
            data.Columns.Add("Field_Value");

            foreach (Control control in (ControlCollection)controls)
            {
                if (control.GetType() == typeof(PlaceHolder))
                {
                    PlaceHolder ph = (PlaceHolder)control;

                    foreach (Control phc in ph.Controls)
                    {
                        DataRow dr = data.NewRow();

                        string test = typeof(CrossBrowser_TextBox).ToString();

                        //if (phc.GetType() == typeof(TextBox))
                        if (phc.GetType().ToString() == "ASP.controls_crossbrowser_textbox_ascx")
                        {
                            TextBox tb = ((CrossBrowser_TextBox)phc).tbxCrossBrowser;
                            dr["Field_ID"] = tb.ID;
                            dr["Field_Value"] = tb.Text;
                        }
                        else if (phc.GetType().ToString() == "ASP.controls_crossbrowser_textarea_ascx")
                        {
                            TextBox tb = ((CrossBrowser_TextArea)phc).tbxCrossBrowser;
                            dr["Field_ID"] = tb.ID;
                            dr["Field_Value"] = tb.Text;
                        }
                        else if (phc.GetType() == typeof(DropDownList))
                        {
                            DropDownList ddl = (DropDownList)phc;
                            dr["Field_ID"] = ddl.ID;
                            dr["Field_Value"] = ddl.Text;
                        }
                        else if (phc.GetType() == typeof(ListBox))
                        {
                            ListBox lb = (ListBox)phc;
                            dr["Field_ID"] = lb.ID;

                            foreach (ListItem li in lb.Items)
                            {
                                if(li.Selected)
                                    dr["Field_Value"] += li.Text + ",";
                            }
                        }

                        data.Rows.Add(dr);
                    }
                }
            }

            return data;
        }
Exemplo n.º 16
0
 /// <summary>
 /// Moves controls from one control collection to the other.
 /// </summary>
 /// <param name="source">Source control collection. Will be
 /// emptied.</param>
 /// <param name="target">Target collection to be filled.</param>
 public static void MoveControls(ControlCollection source, ControlCollection target)
 {
     int count = source.Count;
       for (int i=0; i<count; i++)
       {
     Control ctrl = source[0];
     source.RemoveAt(0);
     target.Add(ctrl);
       }
 }
        private void ApplyCssClass(ControlCollection controls)
        {
            foreach (Control control in controls)
            {
                if (control is Button)
                    ((Button)control).CssClass = ButtonCssClass;

                ApplyCssClass(control.Controls);
            }
        }
Exemplo n.º 18
0
        public static CompositionBatch BuildUpControls(CompositionBatch batch, ControlCollection controls)
        {
            foreach (Control c in controls)
            {
                batch = ComposeWebPartsUtils.BuildUp(batch, c);
                batch = BuildUpControls(batch, c.Controls);
            }

            return batch;
        }
        private void ApplyCssClass(ControlCollection controls)
        {
            foreach (Control control in controls)
            {
                if (control is TextBox)
                    ((TextBox)control).CssClass = TextBoxCssClass;

                ApplyCssClass(control.Controls);
            }
        }
Exemplo n.º 20
0
        private static void GetControlIDsRecursive(ControlCollection controls, IList<string> list)
        {
            foreach (Control c in controls) {
                if (!String.IsNullOrEmpty(c.ID))
                    list.Add(c.ID);

                if (c.HasControls() && !(c is INamingContainer))
                    GetControlIDsRecursive(c.Controls, list);
            }
        }
Exemplo n.º 21
0
 protected void LimpiarControles(ControlCollection cc)
 {
     foreach (Control c in cc)
     {
         if (c is System.Web.UI.WebControls.TextBox)
             (c as TextBox).Text = String.Empty;
         else if (c.Controls.Count > 0)
             LimpiarControles(c.Controls);
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// 获取自定义服务器控件
 /// <remarks>存放于_rightControls中</remarks>
 /// </summary>
 /// <param name="cc"></param>
 private void GetCustomServerButtons(ControlCollection cc)
 {
     foreach (Control c in cc)
     {
         if (c is ICustomControl)
             _rightControls.Add(c);
         else if (c.HasControls())
             GetCustomServerButtons(c.Controls);
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// Outputs the page navigation to the page.
        /// </summary>
        /// <param name="controlCollection">the pages' controls</param>
        /// <param name="path">The path of the current image directory being browsed</param>
        /// <param name="pageSize">The number of items on a page</param>
        /// <param name="maxIndex">The index of the last item on the last page</param>
        /// <param name="currIndex">The index of the first item in this page</param>
        public static void RendenderPageNavigation(System.Web.UI.ControlCollection controlCollection, string path,
                                                   int pageSize, int maxIndex, int currIndex, System.Web.UI.Control ctrl)
        {
            if (maxIndex >= pageSize)
            {
                HyperLink h = null;

                // Previous-Button.
                if (currIndex >= pageSize)
                {
                    h = new HyperLink();
                    int previousPageFirst = ((int)(currIndex / pageSize) - 1) * pageSize;
                    h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + path + ";" + previousPageFirst.ToString());
                    h.Text        = "1";

                    System.Web.UI.WebControls.Image prevImg = new System.Web.UI.WebControls.Image();
                    prevImg.ImageUrl = "NavPreviousSmall.gif";
                    prevImg.Attributes.Add("align", "middle");
                    h.Controls.Add(prevImg);
                    controlCollection.Add(h);
                }

                // List all Pages.
                for (int index = 0; index <= maxIndex; index += pageSize)
                {
                    h = new HyperLink();
                    if ((currIndex < index) || (currIndex >= index + pageSize))
                    {
                        h.Text        = (index / pageSize + 1).ToString() + "  ";
                        h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + path + ";" + index.ToString());
                    }
                    else
                    {
                        h.Text = "[" + (index / pageSize + 1).ToString() + "]  ";
                    }
                    h.Attributes.Add("class", "LinkButton");
                    controlCollection.Add(h);
                }

                // Next Button.
                if (currIndex < ((int)(maxIndex / pageSize)) * pageSize)
                {
                    h = new HyperLink();
                    int nextPageFirst = ((int)(currIndex / pageSize) + 1) * pageSize;
                    h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + path + ";" + nextPageFirst.ToString());
                    h.Text        = "1";

                    System.Web.UI.WebControls.Image nextImg = new System.Web.UI.WebControls.Image();
                    nextImg.ImageUrl = "NavNextSmall.gif";
                    nextImg.Attributes.Add("align", "middle");
                    h.Controls.Add(nextImg);
                    controlCollection.Add(h);
                }
            }
        }
 private void GetControlTree(Dictionary<string, Type> results, ControlCollection controls)
 {
     foreach (Control control in controls)
     { 
         results.Add(control.UniqueID, control.GetType()); 
         if (control.HasControls())
         {
             GetControlTree(results, control.Controls);
         }   
     } 
 }
Exemplo n.º 25
0
 public DeptGrid(NameValueCollection form, ControlCollection controls, CurrentUser user)
 {
     grid = new WebGrid("lkup_department", user, "deptGrid");
     grid.objectId = "lkup_department";
     grid.form = form;
     grid.controls = controls;
     grid.fields.Add(new DisplayField(grid, "department_code", "Dept Code", null, true, "department_code"));
     grid.fields.Add(new DisplayField(grid, "department_code_description", "Dept Description", null, true, "department_code_description"));
     grid.fields.Add(new DisplayField(grid, "first_name", "Contact Name", null, true, "first_name"));
     grid.fields.Add(new DisplayField(grid, "last_name", "Last Name", null, false, "last_name"));
 }
 public void ClearControls(ControlCollection cntrl)
 {
    foreach(Control ctl in cntrl)
    {
        if(ctl is TextBox)
        {
            (ctl as TextBox).Text = " ";
        }
        ClearControls(ctl.Controls);
    }
 }
Exemplo n.º 27
0
        private string[] GetValuesArray(ControlCollection coll)
        {
            List<string> values = new List<string>();
            foreach (Control control in coll)
            {
                if (control is RadioButtonList)
                {
                    for (int i = 0; i < ((RadioButtonList)control).Items.Count; i++)
                    {
                        values.Add(string.Format("{0}_{1}:{2}", control.ClientID, i, ((RadioButtonList)control).Items[i].Selected.ToString().ToLower()));
                    }
                }
                else if (control is CheckBox && control.Parent is CheckBoxList)
                {
                    // checked checkboxes within a list appear as real controls
                }
                else if (control is CheckBoxList)
                {
                    for (int i = 0; i < ((CheckBoxList)control).Items.Count; i++)
                    {
                        values.Add(string.Format("{0}_{1}:{2}", control.ClientID, i, ((CheckBoxList)control).Items[i].Selected.ToString().ToLower()));
                    }
                }
                else if (control is ListControl)
                {
                    StringBuilder data = new StringBuilder();
                    StringBuilder selection = new StringBuilder();
                    foreach (ListItem item in ((ListControl)control).Items)
                    {
                        data.AppendLine(item.Text);
                        selection.AppendLine(item.Selected.ToString().ToLower());
                    }
                    values.Add(string.Format("{0}:data:{1}", control.ClientID, Uri.EscapeDataString(data.ToString())));
                    values.Add(string.Format("{0}:selection:{1}", control.ClientID, Uri.EscapeDataString(selection.ToString())));
                }
                else if (control is IEditableTextControl)
                {
                    values.Add(string.Format("{0}:{1}", control.ClientID, Uri.EscapeDataString(((IEditableTextControl)control).Text)));
                }
                else if (control is ICheckBoxControl)
                {
                    values.Add(string.Format("{0}:{1}", control.ClientID, ((ICheckBoxControl)control).Checked.ToString().ToLower()));
                }
                else if (control is AjaxControlToolkit.HTMLEditor.Editor)
                {
                    AjaxControlToolkit.HTMLEditor.Editor editorControl = control as AjaxControlToolkit.HTMLEditor.Editor;
                    values.Add(string.Format("{0}:{1}", editorControl.ClientID, editorControl.Content));
                }

                values.AddRange(GetValuesArray(control.Controls));
            }
            return values.ToArray();
        }
Exemplo n.º 28
0
        public static Control getControl(ControlCollection cc, string controlName)
        {
            foreach (Control c in cc)
            {
                if (c.ID != null && c.ID.Equals(controlName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return c;
                }

            }
            return null;
        }
Exemplo n.º 29
0
 /// <summary>
 /// 在控件集合中查找IDataControl,并放到一个IDataControl集合实例中
 /// </summary>
 /// <param name="controls">容器的控件集合</param>
  /// <param name="dcList">IDataControl集合实例</param>
  /// <returns>IDataControl集合实例</returns>
 public  List<IDataControl> FindControl(ControlCollection controls, List <IDataControl > dcList)
  {
      foreach (Control ctr in controls)
      {
          if (ctr is IDataControl)
              dcList.Add(ctr as IDataControl);
          else
              if (ctr.HasControls())
                  dcList = FindControl(ctr.Controls, dcList);
      }
      return dcList;
  }
Exemplo n.º 30
0
        ////Boton de confirmacion de login:
        //protected void btningresar_Click(object sender, EventArgs e)
        //{
        //    if (Page.IsValid)
        //    {
        //        lblconfirmar.Text = "Ingreso correcto";
        //    }
        //    else
        //    {
        //        lblconfirmar.Text = "";
        //    }
        //}
        //Función que permite limpiar todos los controles de una página Web
        //recursivamente. Útil cuando en la página existen varios controles
        //evita tener que limpiar uno por uno.
        public void CleanControl(ControlCollection controles)
        {
            foreach (Control control in controles)
            {
                if (control is TextBox)
                    ((TextBox)control).Text = string.Empty;

                    //Esta linea detécta un Control que contenga otros Controles
                    //Así ningún control se quedará sin ser limpiado.
                    CleanControl(control.Controls);
            }
        }
Exemplo n.º 31
0
 private Chart FindChart(ControlCollection controls)
 {
     foreach (Control c in controls)
         if (c is Chart)
             return ((Chart)(c));
         else
         {
             Chart result = FindChart(c.Controls);
             if (result != null)
                 return result;
         }
     return null;
 }
Exemplo n.º 32
0
 /// <summary>
 /// Clear Control 
 /// </summary>
 /// <param name="ctrls"></param>
 /// <param name="Message"></param>
 /// <returns></returns>
 public void ClearInputs(ControlCollection ctrls)
 {
     foreach (Control ctrl in ctrls)
     {
         if (ctrl is TextBox)
             ((TextBox)ctrl).Text = string.Empty;
         else if (ctrl is DropDownList)
             ((DropDownList)ctrl).ClearSelection();
         else if (ctrl is FileUpload)
             ((FileUpload)ctrl).Attributes.Clear();
         ClearInputs(ctrl.Controls);
     }
 }
Exemplo n.º 33
0
        /// <summary>
        /// Outputs some navigation links to the page.
        /// </summary>
        /// <param name="controlCollection">the pages' controls</param>
        /// <param name="path">The path of the current image directory being browsed</param>
        /// <param name="url">The URL to use in the links</param>
        public static void RendenderLinkPath(System.Web.UI.ControlCollection controlCollection, string path, System.Web.UI.Control ctrl, ImageBrowserConfig cfg)
        {
            HyperLink h = null;
            Literal   l = null;

            DirectorySettingsHandler RootSettings = new DirectorySettingsHandler(cfg.PictureRootDirectory, "My Pictures");

            if (path != null && path.Length > 0)
            {
                path = path.Replace(@"\", "/");
            }
            else
            {
                h             = new HyperLink();
                h.NavigateUrl = "";
                h.Text        = RootSettings.DirectoryCaption;
                h.Attributes.Add("class", "LinkButton");
                controlCollection.Add(h);
                return;
            }

            string[] paths = path.Split('/');

            paths[0] = RootSettings.DirectoryCaption;

            for (int i = 1; i <= paths.Length; i++)
            {
                DirectorySettingsHandler DirSetting = new DirectorySettingsHandler(
                    cfg.PictureRootDirectory + "\\" + string.Join("\\", paths, 0, i).Replace(RootSettings.DirectoryCaption, ""), paths[i - 1]);
                if (i < paths.Length)
                {
                    h             = new HyperLink();
                    h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + string.Join("/", paths, 0, i).Replace(RootSettings.DirectoryCaption, "") + ";0");
                    h.Text        = DirSetting.DirectoryCaption;
                    h.Attributes.Add("class", "LinkButton");
                    controlCollection.Add(h);

                    l      = new Literal();
                    l.Text = " &raquo; \n";
                    controlCollection.Add(l);
                }
                else
                {
                    h             = new HyperLink();
                    h.NavigateUrl = "";
                    h.Text        = DirSetting.DirectoryCaption;
                    h.Attributes.Add("class", "LinkButton");
                    controlCollection.Add(h);
                }
            }
        }
Exemplo n.º 34
0
        public void MostrarMensaje(System.Web.UI.ControlCollection control, string message, bool cerrarPagina = false)
        {
            string str = null;

            if (cerrarPagina)
            {
                str = "<script language='JavaScript'>alert('" + message.Trim().Replace("'", "\\'").Replace(System.Environment.NewLine, "<br/>") + "'); CloseFormOK();</script>";
            }
            else
            {
                str = "<script language='JavaScript'>alert('" + message.Trim().Replace("'", "\\'").Replace(System.Environment.NewLine, "<br/>") + "');</script>";
            }
            control.Add(new LiteralControl(str));
        }
Exemplo n.º 35
0
        public void ListaCtrls(string Conexion, int sm_cve, System.Web.UI.ControlCollection controles_contenidos)
        {
            try
            {
                PermisoControl pc          = new PermisoControl();
                int            verificador = 0;

                pc.Sm_Cve = sm_cve;
                for (int x = 0; x < controles_contenidos.Count; x++)
                {
                    string Type = controles_contenidos[x].GetType().FullName;
                    if (Type.Contains("RadMultiPage") || Type.Contains("RadPageView") || Type.Contains("Panel"))
                    {
                        ListaCtrls(Conexion, sm_cve, controles_contenidos[x].Controls);
                    }
                    if (Type.Contains("RadNumericTextBox") || Type.Contains("RadTextBox") || Type.Contains("RadComboBox") || Type.Contains("RadDatePicker") || (Type.Contains("CheckBox") && ((CheckBox)controles_contenidos[x]).Text == ""))
                    {
                        pc.Id_Ctrl = controles_contenidos[x].ID;
                        pc.Tipo    = Type;
                        if (x - 2 >= 0)
                        {
                            if (controles_contenidos[x - 2].GetType().FullName.Contains("Label"))
                            {
                                pc.Ctrl_Label  = controles_contenidos[x - 2].ID;
                                pc.Descripcion = ((Label)controles_contenidos[x - 2]).Text;
                            }
                        }
                        else
                        {
                            pc.Descripcion = controles_contenidos[x].ID;
                        }
                        InsertarCtrl(pc, Conexion, ref verificador);
                    }
                    else if (Type.Contains("CheckBox"))
                    {
                        pc.Id_Ctrl     = controles_contenidos[x].ID;
                        pc.Tipo        = Type;
                        pc.Descripcion = ((CheckBox)controles_contenidos[x]).Text;
                        pc.Ctrl_Label  = "";
                        InsertarCtrl(pc, Conexion, ref verificador);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 36
0
    //visualization
    protected void UpdateControls(System.Web.UI.ControlCollection WorkControls)
    {
        int total = WorkControls.Count;

        for (int i = 0; i < total; i++)
        {
            System.Web.UI.Control            c = WorkControls[i] as System.Web.UI.Control;
            System.Web.UI.WebControls.Button b = WorkControls[i] as System.Web.UI.WebControls.Button;
            if (b != null && string.IsNullOrEmpty(b.CssClass))
            {
                b.CssClass = "button";
            }
            if (c != null)
            {
                UpdateControls(c.Controls);
            }
        }
    }
Exemplo n.º 37
0
        private void deshabilitarcontroles(System.Web.UI.ControlCollection controles_contenidos)
        {
            for (int x = 0; x < controles_contenidos.Count; x++)
            {
                string Type = controles_contenidos[x].GetType().FullName;

                if (Type.Contains("RadMultiPage") || Type.Contains("RadPageView") || Type.Contains("Panel"))
                {
                    deshabilitarcontroles(controles_contenidos[x].Controls);
                }

                switch (Type.Replace("Telerik.Web.UI.", ""))
                {
                case "RadNumericTextBox":
                    (controles_contenidos[x] as RadNumericTextBox).Enabled = false;
                    break;

                case "RadTextBox":
                    (controles_contenidos[x] as RadTextBox).Enabled = false;
                    break;

                case "RadComboBox":
                    (controles_contenidos[x] as RadComboBox).Enabled = false;
                    break;

                case "RadDatePicker":
                    (controles_contenidos[x] as RadDatePicker).Enabled = false;
                    break;
                }

                if (Type.Contains("CheckBox"))
                {
                    (controles_contenidos[x] as CheckBox).Enabled = false;
                }

                if (Type.Contains("ImageButton"))
                {
                    (controles_contenidos[x] as ImageButton).Enabled = false;
                }
            }
        }
Exemplo n.º 38
0
 /// <summary>
 /// کنترلها و کنترهای داخلی را بصورت بازگشتی استخراج میکند
 /// </summary>
 /// <param name="result"></param>
 /// <param name="control"></param>
 private void GetControls(List <ResourceControl> result, System.Web.UI.ControlCollection controls)
 {
     for (int i = 0; i < controls.Count; i++)
     {
         System.Web.UI.Control control = controls[i];
         if (control.Controls != null && control.Controls.Count > 0)
         {
             GetControls(result, control.Controls);
         }
         if (control is CpontArt.NavBar)
         {
             CpontArt.NavBar navabar = (NavBar)control;
             NavBarControles.Add(navabar);
         }
         else if (control is CpontArt.ToolBar)
         {
             CpontArt.ToolBar toolabar = (ToolBar)control;
             toolbarControles.Add(toolabar);
         }
     }
 }
Exemplo n.º 39
0
 public static void TranslatePage(System.Web.UI.ControlCollection Controls)
 {
     /*if (ConfigurationManager.AppSettings["Language"] != HyperCatalog.Shared.SessionState.MasterCulture.LanguageCode)
      * {
      * string translatableTypes = ConfigurationManager.AppSettings["NonTranslatable"].ToString();
      * string controlType;
      * for (int i=0;i<Controls.Count;i++)
      * {
      *  controlType = Controls[i].GetType().ToString().ToLower();
      *  if (translatableTypes.IndexOf(controlType)==-1)
      *  {
      *    TranslateProperty("Text", Controls[i]);
      *    TranslateProperty("HeaderText", Controls[i]);
      *  }
      *  if (Controls[i].Controls.Count>0)
      *  {
      *    TranslatePage(Controls[i].Controls);
      *  }
      * }
      * }*/
 }
Exemplo n.º 40
0
        /// <summary>
        /// Hängt die Representation dieses Newsfeeds der übergebenen Control-Collection an.
        /// </summary>
        /// <param name="CtrlCollection"></param>
        public void AddFeedRepresentation(System.Web.UI.ControlCollection CtrlCollection)
        {
            if (!DataExist)
            {
                throw new Exception();
            }

            // Titel einfügen.
            Label TitleLbl = new Label();

            TitleLbl.Text     = Title;
            TitleLbl.CssClass = "NewsTitle";
            CtrlCollection.Add(TitleLbl);
            CtrlCollection.Add(new LiteralControl("<br>"));

            // Limitieren der max. Anzahl der Artikel.
            int nCount = m_Feed.Items.Count;

            if (nCount > MaxNofItems)
            {
                nCount = MaxNofItems;
            }

            // Schlagzeilen einfügen.
            for (int nzIndex = 0; nzIndex < nCount; nzIndex++)
            {
                HyperLink HeadLineLink = new HyperLink();
                HeadLineLink.Text        = ArticleList[nzIndex].Title;
                HeadLineLink.NavigateUrl = ArticleList[nzIndex].Link;
                HeadLineLink.ToolTip     = ArticleList[nzIndex].Description;
                HeadLineLink.Target      = "_blank";
                HeadLineLink.CssClass    = "NewsItem";

                // Die Daten an das NewsData-Objekt anhängen.
                CtrlCollection.Add(HeadLineLink);
                CtrlCollection.Add(new LiteralControl("<br>"));
            }
        }
Exemplo n.º 41
0
        // find DataPager typeof control in child controls
        public static T FindControl <T>(System.Web.UI.ControlCollection controls) where T : class
        {
            T found = default(T);

            if (controls != null && controls.Count > 0)
            {
                for (int i = 0; i < controls.Count; i++)
                {
                    if (found != null)
                    {
                        break;
                    }
                    if (controls[i] is T)
                    {
                        found = controls[i] as T;
                        break;
                    }
                    found = FindControl <T>(controls[i].Controls);
                }
            }

            return(found);
        }
Exemplo n.º 42
0
    ///   <summary>
    ///   dt的显示
    ///   </summary>
    ///   <param   name="fieldName">xml中fieldname的值</param>
    ///   <param   name="value">xml中option的value的值</param>
    public void BindContent(System.Web.UI.ControlCollection page, DataTable dt)
    {
        if (page == null || dt == null || dt.Rows.Count == 0)
        {
            return;
        }
        int count = page.Count;

        for (int i = 0; i < count; i++)
        {
            foreach (System.Web.UI.Control control in page[i].Controls)
            {
                if (control is TextBox)
                {
                    TextBox text = control as TextBox;
                    if (dt.Columns.IndexOf(control.ID.ToString()) >= 0)
                    {
                        text.Text = dt.Rows[0][control.ID.ToString()].ToString();
                    }
                }
            }
        }
    }
Exemplo n.º 43
0
 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);
                 }
             }
         }
     }
 }
Exemplo n.º 44
0
        /// <summary>
        /// Assign the validation controls found on this user control to any NoFormValButton found on the
        /// page, this will stop the email requirement being enforced.
        /// </summary>
        /// <param name="validators"></param>
        private void AssignUCValidatorsToPageNoFormValButtons(System.Web.UI.ControlCollection cc, string validators)
        {
            foreach (Control control in cc)
            {
                if (control.GetType().FullName == "P1TP.Components.Web.Validation.NoFormValButton")
                {
                    NoFormValButton nfvb = (NoFormValButton)control;

                    if (!this.Controls.Contains(nfvb))
                    {
                        if (nfvb.NoFormValList.Trim() == String.Empty)
                        {
                            nfvb.NoFormValList = validators;
                        }
                        else
                        {
                            nfvb.NoFormValList += "," + validators;
                        }
                    }
                }

                AssignUCValidatorsToPageNoFormValButtons(control.Controls, validators);
            }
        }
Exemplo n.º 45
0
 protected void Highlitable(System.Web.UI.ControlCollection controls)
 {
     foreach (Control ctrl in controls)
     {
         if (ctrl.Controls.Count > 0)
         {
             Highlitable(ctrl.Controls);
         }
         if ("Button".Equals(ctrl.GetType().Name, StringComparison.OrdinalIgnoreCase))
         {
             Button btn = (Button)ctrl;
             if (selectedButtons.Contains(btn))
             {
                 btn.BackColor = System.Drawing.Color.LightBlue;
                 btn.Font.Bold = true;
             }
             else
             {
                 btn.BackColor = SaveColor;
                 btn.Font.Bold = false;
             }
         }
     }
 }
Exemplo n.º 46
0
 public SimpleEnumerator(ControlCollection coll)
 {
     this.coll = coll;
     index     = -1;
     version   = coll.version;
 }
Exemplo n.º 47
0
 internal RetrieveAutoCompleterItemsEventArgs(ASP.ControlCollection coll, string query)
 {
     _coll  = coll;
     _query = query;
 }
 internal ControlCollectionEnumerator(ControlCollection list)
 {
     this.list    = list;
     this.index   = -1;
     this.version = list._version;
 }
Exemplo n.º 49
0
    protected void loadMostWanted()
    {
        //lblMostWanted.Text = "<h3>10 most wanted</h3>";
        System.Web.UI.ControlCollection pnl = pnlMostWanted.Controls;
        string json = "";

        using (var webClient = new System.Net.WebClient())
        {
            string url = String.Format("{0}{1}", System.Configuration.ConfigurationManager.AppSettings["webServiceRootUrl"], "ReportExpiredRepeaters");
            json = webClient.DownloadString(url);
            ViewState["expiredRepeaters"] = json;
        }

        dynamic data = JsonConvert.DeserializeObject <dynamic>(json);

        if (data.Report != null)
        {
            Label lbl = new Label();
            lbl.Text = string.Format("<h3>{0}</h3><p>These repeaters have expired their coordination. If you know anything that may lead to the <del>arrest and conviction</del> updating of this record, please contact us or the repeater owner.", data.Report.Title);
            pnl.Add(lbl);

            Table table = new Table();
            using (TableRow headerRow = new TableRow())
            {
                headerRow.AddCell("Expired");
                headerRow.AddCell("Repeater");
                headerRow.AddCell("City");
                headerRow.AddCell("Sponsor");
                headerRow.AddCell("Trustee");
                headerRow.CssClass = "expiredRepeaterHeader";
                table.Rows.Add(headerRow);
            }

            if (data.Report.Data != null)
            {
                foreach (dynamic item in data.Report.Data)
                {
                    dynamic repeater = item.Repeater;

                    using (TableRow row = new TableRow())
                    {
                        row.AddCell((string)repeater.YearsExpired + " yrs");
                        row.AddCell(string.Format("<a target='_blank' title='Details' href='/repeaters/details/?id={0}'>{1}<br>{2}</a>", (string)repeater.ID, (string)repeater.Output, (string)repeater.Callsign));
                        row.AddCell((string)repeater.City);
                        row.AddCell((string)repeater.Sponsor);
                        row.AddCell(string.Format("<a target='_blank' title='QRZ' href='https://qrz.com/db/{0}'>{1}</a>", (string)repeater.Trustee.Callsign, (string)repeater.Trustee.Name));
                        row.CssClass = "expiredRepeaterData";
                        table.Rows.Add(row);
                    }
                }
            }
            else
            {
                using (TableRow row = new TableRow())
                {
                    row.AddCell("None! We're all current! Yay!", 5);
                    row.CssClass = "expiredRepeaterData";
                    table.Rows.Add(row);
                }
            }
            pnl.Add(table);
        }
    }
        protected override void CreateFilterCtrl(System.Web.UI.Control NamingContainer, System.Web.UI.ControlCollection content)
        {
            content.Add(
                new HtmlCtrl.DIV()
            {
                CssStyleBld = new css.StyleBuilder()
                {
                    Position = css.Position.Relative,
                    Width    = css.Length.Percent(100)
                },

                Content = new Control[] {
                    // Button: Beginns Zeitintervall zurücksetzen
                    new HtmlCtrl.Button("btn" + ColName + "ResetStart")
                    {
                        CssStyleBld = new css.StyleBuilder()
                        {
                            TextAlign    = css.TextAlign.Left,
                            Width        = css.Length.Pixel(15),
                            PaddingLeft  = css.Length.Pixel(2),
                            PaddingRight = css.Length.Pixel(2)
                        },
                        Text     = "[",
                        SetClick = new EventHandler(btnResetVon_Click)
                    },

                    //// Zahlenbox Von
                    //new HtmlCtrl.DateBox("dbx" + ColName + "FltBegin"){

                    //    CssStyleBld = new css.StyleBuilder() {
                    //        Width = new css.LengthMeasurePixel {Value = 70}
                    //    },

                    //    SetLoad = new EventHandler(_tbxBegin_Load),
                    //    SetTextChanged = new EventHandler(_tbxBegin_TextChanged)

                    //},

                    new HtmlCtrl.BR(),

                    // Button: Ende Zeitintervall zurücksetzen
                    new HtmlCtrl.Button("btn" + ColName + "ResetEnd")
                    {
                        CssStyleBld = new css.StyleBuilder()
                        {
                            TextAlign    = css.TextAlign.Right,
                            Width        = css.Length.Pixel(15),
                            PaddingLeft  = css.Length.Pixel(2),
                            PaddingRight = css.Length.Pixel(2)
                        },
                        Text     = "]",
                        SetClick = new EventHandler(btnResetBis_Click)
                    },


                    //// Datumsbox End Zeitintervall
                    //new HtmlCtrl.DateBox("dbx" + ColName + "FltEnd"){

                    //    CssStyleBld = new css.StyleBuilder() {
                    //        Width = new css.LengthMeasurePixel {Value = 70}
                    //    },

                    //    SetLoad = new EventHandler(_tbxEnd_Load),
                    //    SetTextChanged = new EventHandler(_tbxEnd_TextChanged)
                    //}
                }
            }
                );
        }
Exemplo n.º 51
0
        private void _Count_Radio(System.Web.UI.ControlCollection objcol, string radname)
        {
            try
            {
                int iID;
                int iNO;

                foreach (object obj in objcol)
                {
                    System.Type itype = obj.GetType();
                    if (itype.Namespace == "Ext.Net" || itype.Namespace == "System.Web.UI.HtmlControls")
                    {
                        switch (itype.Name)
                        {
                        case "HtmlForm":
                            System.Web.UI.HtmlControls.HtmlForm htmlform = (System.Web.UI.HtmlControls.HtmlForm)obj;
                            _Count_Radio(htmlform.Controls, radname);
                            break;

                        case "Viewport":
                            Ext.Net.Viewport viewport = (Ext.Net.Viewport)obj;
                            _Count_Radio(viewport.Controls, radname);
                            break;

                        case "FormPanel":
                            Ext.Net.FormPanel formpanel = (Ext.Net.FormPanel)obj;
                            _Count_Radio(formpanel.Controls, radname);
                            break;

                        case "Panel":
                            Ext.Net.Panel panel = (Ext.Net.Panel)obj;
                            _Count_Radio(panel.Controls, radname);
                            break;

                        case "TabPanel":
                            Ext.Net.TabPanel tabpanel = (Ext.Net.TabPanel)obj;
                            _Count_Radio(tabpanel.Controls, radname);
                            break;

                        case "Container":
                            Ext.Net.Container container = (Ext.Net.Container)obj;
                            _Count_Radio(container.Controls, radname);
                            break;

                        case "FieldSet":
                            Ext.Net.FieldSet fieldset = (Ext.Net.FieldSet)obj;
                            _Count_Radio(fieldset.Controls, radname);
                            break;

                        case "ContentContainer":
                            Ext.Net.ContentContainer contentcontainer = (Ext.Net.ContentContainer)obj;
                            _Count_Radio(contentcontainer.Controls, radname);
                            break;

                        case "RadioGroup":
                            Ext.Net.RadioGroup radioGroup = (Ext.Net.RadioGroup)obj;
                            _Count_Radio(radioGroup.Controls, radname);
                            break;

                        case "Radio":
                            Ext.Net.Radio radio = (Ext.Net.Radio)obj;

                            string[] s = radio.ID.Split('_');
                            iID = Convert.ToInt16(s[1]);
                            iNO = Convert.ToInt16(s[2]);

                            if (iID > 1 && iID < 38)
                            {
                                if (radio.Value.Equals(true))
                                {
                                    iSCORE = iSCORE + iNO - 1;
                                }
                            }
                            break;

                        case "":

                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _ErrorMsgShow(ex.Message.ToString());
            }
        }
        protected override void CreateFilterCtrl(System.Web.UI.Control NamingContainer, System.Web.UI.ControlCollection content)
        {
            content.Add(
                new HtmlCtrl.DIV()
            {
                CssStyleBld = new css.StyleBuilder()
                {
                    Position = css.Position.Relative,
                    Width    = new css.LengthRealtive()
                    {
                        Value = 100
                    }
                },

                Content = new Control[] {
                    // Button: Beginns Zeitintervall zurücksetzen
                    new HtmlCtrl.Button("btn" + ColName + "ResetStart")
                    {
                        CssStyleBld = new css.StyleBuilder()
                        {
                            TextAlign = css.TextAlign.Left,
                            Width     = new css.LengthPixel()
                            {
                                Value = 15
                            },
                            PaddingLeft = new css.LengthPixel()
                            {
                                Value = 2
                            },
                            PaddingRight = new css.LengthPixel()
                            {
                                Value = 2
                            }
                        },
                        Text     = "[",
                        SetClick = new EventHandler(btnResetStart_Click)
                    },

                    // Datumsbox Beginn Zeitintervall
                    new HtmlCtrl.DateBox("dbx" + ColName + "FltBegin")
                    {
                        CssStyleBld = new css.StyleBuilder()
                        {
                            Width = new css.LengthPixel {
                                Value = 70
                            }
                        },

                        SetLoad        = new EventHandler(_tbxBegin_Load),
                        SetTextChanged = new EventHandler(_tbxBegin_TextChanged)
                    },

                    new HtmlCtrl.BR(),

                    // Button: Ende Zeitintervall zurücksetzen
                    new HtmlCtrl.Button("btn" + ColName + "ResetEnd")
                    {
                        CssStyleBld = new css.StyleBuilder()
                        {
                            TextAlign = css.TextAlign.Right,
                            Width     = new css.LengthPixel()
                            {
                                Value = 15
                            },
                            PaddingLeft = new css.LengthPixel()
                            {
                                Value = 2
                            },
                            PaddingRight = new css.LengthPixel()
                            {
                                Value = 2
                            }
                        },
                        Text     = "]",
                        SetClick = new EventHandler(btnResetEnd_Click)
                    },


                    // Datumsbox End Zeitintervall
                    new HtmlCtrl.DateBox("dbx" + ColName + "FltEnd")
                    {
                        CssStyleBld = new css.StyleBuilder()
                        {
                            Width = new css.LengthPixel {
                                Value = 70
                            }
                        },

                        SetLoad        = new EventHandler(_tbxEnd_Load),
                        SetTextChanged = new EventHandler(_tbxEnd_TextChanged)
                    }
                }
            }
                );
        }
Exemplo n.º 53
0
        protected override void CreateContent(System.Web.UI.Control NamingContainer, System.Web.UI.ControlCollection content)
        {
            var hinweis = new HtmlCtrl.P()
            {
                InnerText   = EmptyDataText,
                CssStyleBld = EmptyDataTextStyle
            };

            content.Add(hinweis);
            content.Add(new HtmlCtrl.BR());

            var btnRemove = new Button()
            {
                Text = RemoveButtonCaption
            };

            btnRemove.Attributes.Add("style", RemoveButtonStyle.ToString());
            btnRemove.Click += new EventHandler(btnRemove_Click);
            content.Add(btnRemove);

            content.Add(new HtmlCtrl.BR());

            // Alle aktuell gültigen Filter auflisten
            var fltTab = new System.Web.UI.HtmlControls.HtmlTable();

            content.Add(fltTab);
            fltTab.Attributes.Add("style", CurrentlyActiveFiltersTabStyle.ToString());

            var header = new System.Web.UI.HtmlControls.HtmlTableRow();

            fltTab.Rows.Add(header);

            var col1Header = new System.Web.UI.HtmlControls.HtmlTableCell()
            {
                InnerText = "Filter"
            };

            header.Cells.Add(col1Header);
            var col1HeaderCssBld = new css.StyleBuilder(CurrentlyActiveFiltersTabCellDescription);

            col1HeaderCssBld.FontWeight = new css.FontWeightMeasure()
            {
                Value = css.FontWeightMeasure.Unit.bold
            };
            col1Header.Attributes.Add("style", col1HeaderCssBld.ToString());

            var col2Header = new System.Web.UI.HtmlControls.HtmlTableCell()
            {
                InnerText = "entfernen ja/nein"
            };

            header.Cells.Add(col2Header);
            var col2HeaderCssBld = new css.StyleBuilder(CurrentlyActiveFiltersTabCellAction);

            col2HeaderCssBld.FontWeight = new css.FontWeightMeasure()
            {
                Value = css.FontWeightMeasure.Unit.bold
            };
            col2Header.Attributes.Add("style", col2HeaderCssBld.ToString());



            int line = 0;

            foreach (var flt in sessVar.Filters)
            {
                var row = new System.Web.UI.HtmlControls.HtmlTableRow();
                fltTab.Rows.Add(row);

                var descr = new System.Web.UI.HtmlControls.HtmlTableCell()
                {
                    InnerText = flt.Value.Description
                };
                descr.Attributes.Add("style", CurrentlyActiveFiltersTabCellDescription.ToString());
                row.Cells.Add(descr);

                var action = new System.Web.UI.HtmlControls.HtmlTableCell();
                action.Attributes.Add("style", CurrentlyActiveFiltersTabCellAction.ToString());
                action.Controls.Add(new CheckBox()
                {
                    ID = "cbxCtrl" + line++, ClientIDMode = ClientIDMode.Static, Checked = true
                });
                row.Cells.Add(action);
            }
        }
Exemplo n.º 54
0
    protected void loadExpiredRepeatersReport()
    {
        System.Web.UI.ControlCollection pnl = pnlExpiredRepeaters.Controls;
        string json = "";

        if (ViewState["expiredRepeaters"] == null)
        {
            using (var webClient = new System.Net.WebClient())
            {
                string url = String.Format(System.Configuration.ConfigurationManager.AppSettings["webServiceRootUrl"] + "ReportNonstandardRepeaters?callsign={0}&password={1}", creds.Username, creds.Password);
                json = webClient.DownloadString(url);
                ViewState["expiredRepeaters"] = json;
            }
        }
        else
        {
            json = ViewState["expiredRepeaters"].ToString();
        }

        dynamic data = JsonConvert.DeserializeObject <dynamic>(json);

        lblTitle.Text  = data.Report.Title;
        lblTitle2.Text = data.Report.Title;

        Table table = new Table();

        if (data.Report != null)
        {
            foreach (dynamic item in data.Report.Data)
            {
                dynamic repeater = item.Repeater;

                using (TableRow headerRow = new TableRow())
                {
                    headerRow.AddCell("ID");
                    headerRow.AddCell("Callsign");
                    headerRow.AddCell("Xmit freq");
                    headerRow.AddCell("Rcv freq");
                    headerRow.AddCell("City");
                    headerRow.AddCell("Sponsor");
                    headerRow.AddCell("Trustee");
                    headerRow.AddCell("Contact info");
                    headerRow.CssClass = "expiredRepeaterHeader";
                    table.Rows.Add(headerRow);
                }

                using (TableRow row = new TableRow())
                {
                    row.AddCell(string.Format("<a target='_blank' href='/update/?id={0}'>{0}</a>", (string)repeater.ID));
                    row.AddCell(string.Format("<a target='_blank' href='https://qrz.com/db/{0}'>{0}</a>", (string)repeater.Callsign));
                    row.AddCell((string)repeater.Output);
                    row.AddCell((string)repeater.Input);
                    row.AddCell((string)repeater.City);
                    row.AddCell((string)repeater.Sponsor);
                    row.AddCell(string.Format("<a target='_blank' href='https://qrz.com/db/{0}'>{1}</a>", (string)repeater.Trustee.Callsign, (string)repeater.Trustee.Name));

                    string strContact = string.Empty;
                    if ((string)repeater.Trustee.Email != string.Empty)
                    {
                        if (strContact != string.Empty)
                        {
                            strContact += ", ";
                        }
                        strContact += "<a href='mailto:" + (string)repeater.Trustee.Email + "'>" + (string)repeater.Trustee.Email + "</a> ";
                    }

                    string strPhone = string.Empty;
                    if ((string)repeater.Trustee.CellPhone != string.Empty)
                    {
                        if (strContact != string.Empty)
                        {
                            strContact += ", ";
                        }
                        strPhone    = (string)repeater.Trustee.CellPhone;
                        strContact += "<a href='tel:" + strPhone + "'>" + strPhone + "</a> (cell)";
                    }
                    if ((string)repeater.Trustee.HomePhone != string.Empty)
                    {
                        if (strContact != string.Empty)
                        {
                            strContact += ", ";
                        }
                        strPhone    = (string)repeater.Trustee.HomePhone;
                        strContact += "<a href='tel:" + strPhone + "'>" + strPhone + "</a> (home)";
                    }
                    if ((string)repeater.Trustee.WorkPhone != string.Empty)
                    {
                        if (strContact != string.Empty)
                        {
                            strContact += ", ";
                        }
                        strPhone    = (string)repeater.Trustee.WorkPhone;
                        strContact += "<a href='tel:" + strPhone + "'>" + strPhone + "</a> (work)";
                    }

                    row.AddCell(strContact);
                    row.CssClass = "expiredRepeaterData";
                    table.Rows.Add(row);
                }

                using (TableRow row = new TableRow())
                {
                    string strNotes = "";
                    if (repeater.Notes != null)
                    {
                        strNotes = "<ul>";
                        foreach (dynamic obj in repeater.Notes)
                        {
                            string note = ((string)obj.Note.Text).Replace("•", "<br>&bull;");
                            strNotes += string.Format("<li>{0} - {1} ({2}, {3})</li>", obj.Note.Timestamp, note, obj.Note.User.Name, obj.Note.User.Callsign);
                        }
                        strNotes += "</ul>";
                    }
                    else
                    {
                        strNotes = "<ul><li><em>There are no notes on record for this repeater.</em></li></ul>";
                    }
                    row.AddCell(strNotes, 8);
                    row.CssClass = "expiredRepeaterNotes";
                    table.Rows.Add(row);
                }

                using (TableRow row = new TableRow())
                {
                    Label label = new Label();
                    label.Text = "Note: ";
                    TextBox textbox = new TextBox();
                    textbox.ID       = "txt" + repeater.ID;
                    textbox.CssClass = "expiredRepeaterNote";
                    Button button = new Button();
                    button.CommandArgument = repeater.ID;
                    button.CommandName     = "saveNote";
                    button.Click          += Button_Click;
                    button.Text            = "Save";

                    TableCell cell = new TableCell();
                    cell.Controls.Add(label);
                    cell.Controls.Add(textbox);
                    cell.Controls.Add(button);
                    cell.ColumnSpan = 8;
                    row.Cells.Add(cell);
                    row.CssClass = "expiredRepeaterNewNote";
                    table.Rows.Add(row);
                }
            }
        }
        pnlExpiredRepeaters.Controls.Add(table);
    }
Exemplo n.º 55
0
    protected void loadOpenRequestsReport()
    {
        System.Web.UI.ControlCollection pnl = pnlOpenRequests.Controls;
        string json = "";

        if (ViewState["ReportOpenCoordinationRequests"] == null)
        {
            using (var webClient = new System.Net.WebClient())
            {
                string url = String.Format(System.Configuration.ConfigurationManager.AppSettings["webServiceRootUrl"] + "ReportOpenCoordinationRequests?callsign={0}&password={1}", creds.Username, creds.Password);
                json = webClient.DownloadString(url);
                ViewState["ReportOpenCoordinationRequests"] = json;
            }
        }
        else
        {
            json = ViewState["ReportOpenCoordinationRequests"].ToString();
        }

        dynamic data = JsonConvert.DeserializeObject <dynamic>(json);

        Table table = new Table();

        if ((data.Report != null) && (data.Report.Data != null))
        {
            foreach (dynamic item in data.Report.Data)
            {
                dynamic request = item.Request;

                using (TableRow headerRow = new TableRow())
                {
                    headerRow.AddCell("ID", "requestHeader");
                    headerRow.AddCell("Requested on");
                    headerRow.AddCell("Requested by");
                    headerRow.AddCell("Latitude");
                    headerRow.AddCell("Longitude");
                    headerRow.AddCell("Transmit frequency");
                    headerRow.CssClass = "requestHeader";
                    table.Rows.Add(headerRow);
                }

                using (TableRow row = new TableRow())
                {
                    row.AddCell((string)request.ID);
                    row.AddCell((string)request.RequestedDate);
                    row.AddCell((string)request.RequestedBy);
                    row.AddCell((string)request.Latitude);
                    row.AddCell((string)request.Longitude);
                    row.AddCell((string)request.OutputFrequency);
                    row.CssClass = "requestDetails";
                    table.Rows.Add(row);
                }

                using (TableRow row = new TableRow())
                {
                    row.AddCell("Workflows", 6);
                    row.CssClass = "workflowDivider";
                    table.Rows.Add(row);
                }

                using (TableRow headerRow = new TableRow())
                {
                    headerRow.AddCell("&nbsp;");
                    headerRow.AddCell("State");
                    headerRow.AddCell("Status");
                    headerRow.AddCell("Time stamp");
                    headerRow.AddCell("Last reminder");
                    headerRow.AddCell("Note");
                    headerRow.CssClass = "workflowHeader";
                    table.Rows.Add(headerRow);
                }

                foreach (dynamic thing in request.Workflows)
                {
                    dynamic workflow = thing.Workflow;
                    using (TableRow row = new TableRow())
                    {
                        row.AddCell((string)"&nbsp;");
                        row.AddCell((string)workflow.State);
                        row.AddCell((string)workflow.Status);
                        row.AddCell((string)workflow.TimeStamp);
                        row.AddCell((string)workflow.LastReminderSent);
                        row.AddCell((string)workflow.Note);
                        row.CssClass = "workflowDetails";
                        table.Rows.Add(row);
                    }
                }

                using (TableRow row = new TableRow())
                {
                    row.AddCell("Workflows", 6);
                    row.CssClass = "workflowDivider";
                    table.Rows.Add(row);
                }
            }
            pnl.Add(table);
        }
        else
        {
            Label label = new Label();
            label.Text = "There are no coordination requests currently open.";
            pnl.Add(label);
        }
    }
Exemplo n.º 56
0
	protected void loadExpiredRepeatersReport()
	{
		System.Web.UI.ControlCollection pnl = pnlExpiredRepeaters.Controls;
		string json = "";

		if (ViewState["expiredRepeaters"] == null)
		{
			using (var webClient = new System.Net.WebClient())
			{
				string url = String.Format(System.Configuration.ConfigurationManager.AppSettings["webServiceRootUrl"] + "ReportExpiredRepeaters?callsign={0}&password={1}", creds.Username, creds.Password);
				json = webClient.DownloadString(url);
				ViewState["expiredRepeaters"] = json;
			}
		}
		else
		{
			json = ViewState["expiredRepeaters"].ToString();
		}

		dynamic data = JsonConvert.DeserializeObject<dynamic>(json);

		Table table = new Table();
		if ((data.Report != null) && (data.Report.Data != null))
		{
			foreach (dynamic item in data.Report.Data)
			{
				dynamic repeater = item.Repeater;
				
				if ((repeater.City == null) || (((string)repeater.City).Trim() == "")) {
					repeater.City = "[blank]";
				}

				using (TableRow headerRow = new TableRow())
				{
					headerRow.AddCell("Expired");
					headerRow.AddCell("ID");
					headerRow.AddCell("Callsign");
					headerRow.AddCell("Xmit freq");
					headerRow.AddCell("City");
					headerRow.AddCell("Sponsor");
					headerRow.AddCell("Trustee");
					headerRow.AddCell("Contact info");
					headerRow.CssClass = "expiredRepeaterHeader";
					table.Rows.Add(headerRow);
				}

				using (TableRow row = new TableRow())
				{
					row.AddCell((string)repeater.YearsExpired + " years");
					row.AddCell(string.Format("<a target='_blank' title='Update' href='/update/?id={0}'>{0}</a>", (string)repeater.ID));
					row.AddCell(string.Format("<a target='_blank' title='QRZ' href='https://qrz.com/db/{0}'>{0}</a>", (string)repeater.Callsign));
					row.AddCell(string.Format("<a target='_blank' title='RepeaterBook' href='https://repeaterbook.com/repeaters/msResult.php?state_id%5B%5D=05&band=%25&freq={0}&loc=&call=&features=%25&emcomm=%25&coverage=%25&status_id=%25&order=%60freq%60%2C+%60state_abbrev%60+ASC'>{0}</a>", (string)repeater.Output));
					row.AddCell(string.Format("<a target='_blank' href='https://www.google.com/maps/search/?api=1&query={1},{2}'>{0}</a>", (string)repeater.City, (string)repeater.Latitude, (string)repeater.Longitude));
					row.AddCell((string)repeater.Sponsor);
					row.AddCell(string.Format("<a target='_blank' title='QRZ' href='https://qrz.com/db/{0}'>{1}</a>", (string)repeater.Trustee.Callsign, (string)repeater.Trustee.Name));

					string strContact = string.Empty;
					if ((string)repeater.Trustee.Email != string.Empty)
					{
						if (strContact != string.Empty) { strContact += ", "; }
						strContact += "<a href='mailto:" + (string)repeater.Trustee.Email + "'>" + (string)repeater.Trustee.Email + "</a> ";
					}

                    string strPhone = string.Empty;
                    if ((string)repeater.Trustee.CellPhone != string.Empty)
                    {
                        if (strContact != string.Empty) { strContact += ", "; }
                        strPhone = (string)repeater.Trustee.CellPhone;
                        strContact += "<a href='tel:" + strPhone + "'>" + strPhone + "</a> (cell)";
                    }
                    if ((string)repeater.Trustee.HomePhone != string.Empty)
                    {
                        if (strContact != string.Empty) { strContact += ", "; }
                        strPhone = (string)repeater.Trustee.HomePhone;
                        strContact += "<a href='tel:" + strPhone + "'>" + strPhone + "</a> (home)";
                    }
                    if ((string)repeater.Trustee.WorkPhone != string.Empty)
                    {
                        if (strContact != string.Empty) { strContact += ", "; }
                        strPhone = (string)repeater.Trustee.WorkPhone;
                        strContact += "<a href='tel:" + strPhone + "'>" + strPhone + "</a> (work)";
                    }

                    row.AddCell(strContact);
					row.CssClass = "expiredRepeaterData";
					table.Rows.Add(row);
				}

				using (TableRow row = new TableRow())
				{
					string strNotes = "";
					if (repeater.Notes != null)
					{
						strNotes = "<ul>";
						foreach (dynamic obj in repeater.Notes)
						{
							strNotes += string.Format("<li>{0} - {1} ({2}, {3})</li>", obj.Note.Timestamp, obj.Note.Text, obj.Note.User.Name, obj.Note.User.Callsign);
						}
						strNotes += "</ul>";
					}
					else
					{
						strNotes = "<ul><li><em>There are no notes on record for this repeater.</em></li></ul>";
					}
					row.AddCell(strNotes, 8);
					row.CssClass = "expiredRepeaterNotes";
					table.Rows.Add(row);
				}

				using (TableRow row = new TableRow())
				{
					Label label = new Label();
					label.Text = "Note: ";
					TextBox textbox = new TextBox();
					textbox.ID = "txt" + repeater.ID;
					textbox.CssClass = "expiredRepeaterNote";
					Button button = new Button();
					button.CommandArgument = repeater.ID;
					button.CommandName = "saveNote";
					button.Click += Button_Click;
					button.Text = "Save";

					TableCell cell = new TableCell();
					cell.Controls.Add(label);
					cell.Controls.Add(textbox);
					cell.Controls.Add(button);
					cell.ColumnSpan = 8;
					row.Cells.Add(cell);
					row.CssClass = "expiredRepeaterNewNote";
					table.Rows.Add(row);
				}
			}
		}
		pnlExpiredRepeaters.Controls.Add(table);

	}
Exemplo n.º 57
0
            /// <summary>
            /// Fill Table According to data
            /// <note type="note">
            /// The table should has one template row with cells and controls already.
            /// And the template row will be removed automatically.
            /// The data should in the order of the table column.
            /// </note>
            /// </summary>
            /// <param name="t">Table</param>
            /// <param name="dt">DataBase</param>
            /// <param name="templateRowIndex">templateRowIndex, default is 1</param>
            /// <example>
            ///		<code>
            ///			&lt;asp:Table ID="TableScoreExchangeInfo" runat="server" CssClass="table borderTopCorner borderAround" CellPadding="0" CellSpacing="0" ForeColor="Black" BorderStyle="None"
            ///			 BorderColor="White" BackColor="White" style="text-overflow:ellipsis;overflow:auto;" OnPreRender="TableScoreExchangeInfo_OnPreRender"&gt;
            ///				&lt;asp:TableRow ID="TableRow32" runat="server" CssClass="tableOddRow" Height="27px"&gt;
            ///					&lt;asp:TableCell ID="TableCell100" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label63" runat="server" Text="积分卡" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell101" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label64" runat="server" Text="兑换类型" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell102" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label65" runat="server" Text="兑换积分" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell103" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label66" runat="server" Text="兑换礼品" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell104" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label67" runat="server" Text="重打印兑换单" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///				&lt;/asp:TableRow&gt;
            ///				&lt;asp:TableRow ID="TableRow31" runat="server" CssClass="tableOddRow" Height="27px"&gt;
            ///					&lt;asp:TableCell ID="TableCell69" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label34" runat="server" Text="" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell73" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label38" runat="server" Text="" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell74" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label39" runat="server" Text="" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell79" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label44" runat="server" Text="" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///					&lt;asp:TableCell ID="TableCell95" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"&gt;
            ///						&lt;asp:Label ID="Label62" runat="server" Text="" CssClass="padding0px2px0px2px"&gt;&lt;/asp:Label&gt;
            ///					&lt;/asp:TableCell&gt;
            ///				&lt;/asp:TableRow&gt;
            ///			&lt;/asp:Table&gt;
            ///		</code>
            ///		<code>
            ///			RF.GlobalClass.WebForm.fillTableAccordingToData(TableScoreExchangeInfo, dataSet.Tables["ScoreData", "ScoreDetails"]);
            ///		</code>
            /// </example>
            public static void fillTableAccordingToData(Table t, DataTable dt, DataTable dtInfo = null, int templateRowIndex = 1, int templateFooterRowIndex = -1, String ellipsisTitle = "{ellipsis}", String ellipsisCls = "Ellipsis")
            {
                if (null == t || null == dt)
                {
                    return;
                }
                else
                {
                }
                try
                {
                    TableRow[]      trs = new TableRow[] { };
                    List <TableRow> ltr = new List <TableRow>();
                    TableRow        tr;
                    TableCell       tc;
                    #region draw table

                    DataRow             dr;
                    int                 dtRowsCount = dt.Rows.Count;
                    int                 drItemArrayLength;
                    TableRow            tempTableRow = t.Rows[templateRowIndex];
                    int                 cellsCount   = tempTableRow.Cells.Count;
                    TableCell           tempTableCell;
                    AttributeCollection act = tempTableRow.Attributes;
                    for (int dti = 0; dti < dtRowsCount; dti++)
                    {
                        dr = dt.Rows[dti];
                        tr = new System.Web.UI.WebControls.TableRow();
                        drItemArrayLength = dr.ItemArray.Length;

                        #region copy style
                        System.Collections.ICollection attrKeys = act.Keys;
                        string[] keys = new string[] { };
                        attrKeys.CopyTo(keys, 0);
                        int    keysLength = keys.Length;
                        string keyName    = String.Empty;
                        for (int ki = 0; ki < keysLength; ki++)
                        {
                            keyName = keys[ki];
                            tr.Attributes.Add(keyName, act[keyName]);
                        }
                        tr.CssClass    = tempTableRow.CssClass;
                        tr.Height      = tempTableRow.Height;
                        tr.Width       = tempTableRow.Width;
                        tr.Style.Value = tempTableRow.Style.Value;

                        keys = new string[] { };
                        tempTableRow.Style.Keys.CopyTo(keys, 0);
                        keysLength = keys.Length;
                        for (int ki = 0; ki < keysLength; ki++)
                        {
                            keyName = keys[ki];
                            tr.Style.Add(keyName, tempTableRow.Style[keyName]);
                        }
                        tr.ToolTip = tempTableRow.ToolTip;
                        #endregion

                        for (int dri = 0; dri < cellsCount; dri++)
                        {
                            tempTableCell = tempTableRow.Cells[dri];

                            tc = new System.Web.UI.WebControls.TableCell();
                            #region copy cell controls
                            System.Web.UI.ControlCollection tempTableCellControls = tempTableCell.Controls;
                            foreach (Control control in tempTableCellControls)
                            {
                                Control _c = RF.GlobalClass.WebForm.ControlCollection.CloneControl(control);
                                if (null != _c)
                                {
                                    tc.Controls.Add(_c);
                                }
                                else
                                {
                                }
                            }
                            #endregion

                            #region bind data
                            if (dri < drItemArrayLength && tc.Controls.Count > 0)
                            {
                                try
                                {
                                    (tc.Controls[0] as ITextControl).Text = dr.ItemArray.GetValue(dri) as String;
                                    if ((tc.Controls[0] as WebControl).CssClass.Split(' ').Contains <string>(ellipsisCls))
                                    {
                                        if ((tc.Controls[0] as WebControl).ToolTip.Contains(ellipsisTitle))
                                        {
                                            (tc.Controls[0] as WebControl).ToolTip = (tc.Controls[0] as WebControl).ToolTip.Replace(ellipsisTitle, (tc.Controls[0] as ITextControl).Text);
                                        }
                                        else if ((tc.Controls[0] as WebControl).ToolTip == String.Empty)
                                        {
                                            (tc.Controls[0] as WebControl).ToolTip = (tc.Controls[0] as ITextControl).Text;
                                        }
                                        else
                                        {
                                        }
                                    }
                                    else
                                    {
                                    }
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                            else
                            {
                            }
                            #endregion

                            #region customized attributes

                            keys = new string[] { };
                            tempTableCell.Attributes.Keys.CopyTo(keys, 0);
                            keysLength = keys.Length;
                            for (int ki = 0; ki < keysLength; ki++)
                            {
                                keyName = keys[ki];
                                tc.Attributes.Add(keyName, tempTableCell.Attributes[keyName]);
                            }

                            #endregion

                            #region copy cell style
                            tc.CssClass = tempTableCell.CssClass;
                            tc.Height   = tempTableCell.Height;
                            tc.Width    = tempTableCell.Width;


                            keys = new string[] { };
                            tempTableCell.Style.Keys.CopyTo(keys, 0);
                            keysLength = keys.Length;
                            for (int ki = 0; ki < keysLength; ki++)
                            {
                                keyName = keys[ki];
                                tc.Style.Add(keyName, tempTableCell.Style[keyName]);
                            }
                            tc.ColumnSpan = tempTableCell.ColumnSpan;
                            tc.RowSpan    = tempTableCell.RowSpan;
                            tc.BackColor  = tempTableCell.BackColor;
                            tc.ToolTip    = tempTableCell.ToolTip;
                            #endregion

                            tr.Cells.Add(tc);
                        }
                        t.Rows.AddAt(templateRowIndex, tr);
                        ltr.Add(tr);
                    }

                    /*
                     * trs = ltr.ToArray();
                     * if (t.Rows.Count > 2)
                     * {
                     *  TableRow[] ltra = new TableRow[(t.Rows.Count - 2)];
                     *  t.Rows.CopyTo(ltra, 0);
                     *  trs = trs.Concat<TableRow>(ltra).ToArray();
                     * }
                     * else { }
                     * t.Rows.AddRange(trs);
                     */
                    t.Rows.Remove(tempTableRow);
                    #endregion

                    #region draw table info
                    if (t.Rows.Count >= dtRowsCount + 2)
                    {
                        if (templateFooterRowIndex > 0 && t.Rows.Count > templateFooterRowIndex)
                        {
                            // dtRowsCount + 1 : consider there is a header.
                            TableRow tempTableFooterRow = t.Rows[dtRowsCount + 1];

                            dtInfo = dtInfo ?? new DataTable();
                            Boolean tmpBool = true;
                            dtInfo.Rows[0].ItemArray.Select(delegate(object obj, int idx)
                            {
                                foreach (Control c in tempTableFooterRow.Controls)
                                {
                                    switch (idx)
                                    {
                                    case 0:
                                        if (true == (c as WebControl).CssClass.Contains("RowTotalCount"))
                                        {
                                            (c as ITextControl).Text = obj + "";
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    case 1:
                                        if (true == (c as WebControl).CssClass.Contains("PerPageRowCount"))
                                        {
                                            (c as ITextControl).Text = obj + "";
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    case 2:
                                        if (true == (c as WebControl).CssClass.Contains("PageTotalCount"))
                                        {
                                            (c as ITextControl).Text = obj + "";
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    case 3:
                                        if (true == (c as WebControl).CssClass.Contains("pageFirst"))
                                        {
                                            tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool;
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    case 4:
                                        if (true == (c as WebControl).CssClass.Contains("pagePrev"))
                                        {
                                            tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool;
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    case 5:
                                        if (true == (c as WebControl).CssClass.Contains("pageNext"))
                                        {
                                            tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool;
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    case 6:
                                        if (true == (c as WebControl).CssClass.Contains("pageLast"))
                                        {
                                            tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool;
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    case 7:
                                        if (true == (c as WebControl).CssClass.Contains("CurrPageNum"))
                                        {
                                            (c as ITextControl).Text = obj + "";
                                        }
                                        else
                                        {
                                        }
                                        break;

                                    default:
                                        break;
                                    }
                                }
                                return(obj);
                            });
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                }
            }
Exemplo n.º 58
0
        private void SetVal(System.Web.UI.ControlCollection ControlliWeb, Hashtable _HS, int pagina)
        {
            clMyControl _myColl = new clMyControl();

            foreach (System.Web.UI.Control _Controllo in ControlliWeb)
            {
                if (_Controllo is System.Web.UI.WebControls.TextBox)
                {
                    _myColl.Valore        = ((System.Web.UI.WebControls.TextBox)_Controllo).Text;
                    _myColl.NomeControllo = ((System.Web.UI.WebControls.TextBox)_Controllo).ClientID + pagina.ToString();

                    string id = _myColl.NomeControllo;
                    if (_HS.ContainsKey(id))
                    {
                        _HS.Remove(id);
                    }
                    _HS.Add(id, _myColl.Valore);
                }
                if (_Controllo is System.Web.UI.HtmlControls.HtmlInputHidden)
                {
                    _myColl.Valore        = ((System.Web.UI.HtmlControls.HtmlInputHidden)_Controllo).Value;
                    _myColl.NomeControllo = ((System.Web.UI.HtmlControls.HtmlInputHidden)_Controllo).ClientID + pagina.ToString();

                    string id = _myColl.NomeControllo;
                    if (_HS.ContainsKey(id))
                    {
                        _HS.Remove(id);
                    }
                    _HS.Add(id, _myColl.Valore);
                }
                if (_Controllo is System.Web.UI.WebControls.Label)
                {
                    _myColl.Valore        = ((System.Web.UI.WebControls.Label)_Controllo).Text;
                    _myColl.NomeControllo = ((System.Web.UI.WebControls.Label)_Controllo).ClientID + pagina.ToString();

                    string id = _myColl.NomeControllo;
                    if (_HS.ContainsKey(id))
                    {
                        _HS.Remove(id);
                    }
                    _HS.Add(id, _myColl.Valore);
                }
                if (_Controllo is System.Web.UI.WebControls.CheckBox)
                {
                    _myColl.Valore        = Convert.ToString(((System.Web.UI.WebControls.CheckBox)_Controllo).Checked);
                    _myColl.NomeControllo = ((System.Web.UI.WebControls.CheckBox)_Controllo).ClientID + pagina.ToString();

                    string id = _myColl.NomeControllo;
                    if (_HS.ContainsKey(id))
                    {
                        _HS.Remove(id);
                    }
                    _HS.Add(id, _myColl.Valore);
                }
                if (_Controllo is System.Web.UI.WebControls.ListBox)
                {
                    _myColl.Valore        = ((System.Web.UI.WebControls.ListBox)_Controllo).SelectedValue;
                    _myColl.NomeControllo = ((System.Web.UI.WebControls.ListBox)_Controllo).ClientID + pagina.ToString();

                    string id = _myColl.NomeControllo;
                    if (_HS.ContainsKey(id))
                    {
                        _HS.Remove(id);
                    }
                    _HS.Add(id, _myColl.Valore);
                }
                if (_Controllo is System.Web.UI.WebControls.DropDownList)
                {
                    _myColl.Valore        = ((System.Web.UI.WebControls.DropDownList)_Controllo).SelectedValue;
                    _myColl.NomeControllo = ((System.Web.UI.WebControls.DropDownList)_Controllo).ClientID + pagina.ToString();

                    string id = _myColl.NomeControllo;
                    if (_HS.ContainsKey(id))
                    {
                        _HS.Remove(id);
                    }
                    _HS.Add(id, _myColl.Valore);
                }
                if (_Controllo is System.Web.UI.WebControls.RadioButton)
                {
                    _myColl.Valore        = Convert.ToString(((System.Web.UI.WebControls.RadioButton)_Controllo).Checked);
                    _myColl.NomeControllo = ((System.Web.UI.WebControls.RadioButton)_Controllo).ClientID + pagina.ToString();

                    string id = _myColl.NomeControllo;
                    if (_HS.ContainsKey(id))
                    {
                        _HS.Remove(id);
                    }
                    _HS.Add(id, _myColl.Valore);
                }

                if (_Controllo.Controls.Count > 0)
                {
                    SetVal(_Controllo.Controls, _HS, pagina);
                }
            }
        }
Exemplo n.º 59
0
        private void GetVal(System.Web.UI.ControlCollection ControlliWeb, Hashtable _HS, int pagina)
        {
            string id = String.Empty;

            foreach (System.Web.UI.Control _Controllo in ControlliWeb)
            {
                if (_Controllo is System.Web.UI.WebControls.TextBox)
                {
                    id = ((System.Web.UI.WebControls.TextBox)_Controllo).ClientID + pagina.ToString();
                    if (_HS.ContainsKey(id))
                    {
                        ((System.Web.UI.WebControls.TextBox)_Controllo).Text = _HS[id].ToString();
                    }
                }
                if (_Controllo is System.Web.UI.HtmlControls.HtmlInputHidden)
                {
                    id = ((System.Web.UI.HtmlControls.HtmlInputHidden)_Controllo).ClientID + pagina.ToString();
                    if (_HS.ContainsKey(id))
                    {
                        ((System.Web.UI.HtmlControls.HtmlInputHidden)_Controllo).Value = _HS[id].ToString();
                    }
                }
                if (_Controllo is System.Web.UI.WebControls.Label)
                {
                    id = ((System.Web.UI.WebControls.Label)_Controllo).ClientID + pagina.ToString();
                    if (_HS.ContainsKey(id))
                    {
                        ((System.Web.UI.WebControls.Label)_Controllo).Text = _HS[id].ToString();
                    }
                }
                if (_Controllo is System.Web.UI.WebControls.CheckBox)
                {
                    id = ((System.Web.UI.WebControls.CheckBox)_Controllo).ClientID + pagina.ToString();
                    if (_HS.ContainsKey(id))
                    {
                        ((System.Web.UI.WebControls.CheckBox)_Controllo).Checked = Boolean.Parse(_HS[id].ToString());
                    }
                }
                if (_Controllo is System.Web.UI.WebControls.ListBox)
                {
                    id = ((System.Web.UI.WebControls.ListBox)_Controllo).ClientID + pagina.ToString();
                    if (_HS.ContainsKey(id))
                    {
                        ((System.Web.UI.WebControls.ListBox)_Controllo).SelectedValue = _HS[id].ToString();
                    }
                }
                if (_Controllo is System.Web.UI.WebControls.DropDownList)
                {
                    id = ((System.Web.UI.WebControls.DropDownList)_Controllo).ClientID + pagina.ToString();
                    if (_HS.ContainsKey(id))
                    {
                        ((System.Web.UI.WebControls.DropDownList)_Controllo).SelectedValue = _HS[id].ToString();
                    }
                }
                if (_Controllo is System.Web.UI.WebControls.RadioButton)
                {
                    id = ((System.Web.UI.WebControls.RadioButton)_Controllo).ClientID + pagina.ToString();
                    if (_HS.ContainsKey(id))
                    {
                        ((System.Web.UI.WebControls.RadioButton)_Controllo).Checked = Boolean.Parse(_HS[id].ToString());
                    }
                }

                if (_Controllo.Controls.Count > 0)
                {
                    GetVal(_Controllo.Controls, _HS, pagina);
                }
            }
        }