Пример #1
0
        protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)

        {
            //get the listview in the wizard
            System.Web.UI.WebControls.ListView list = (Wizard1.FindControl("sideBarList") as System.Web.UI.WebControls.ListView);
            //get the ul in the listview and change its cssclass according to the activestepindex of wizard
            HtmlGenericControl ul = list.FindControl("ul") as HtmlGenericControl;

            if (Wizard1.ActiveStepIndex == 0)
            {
                ul.Attributes.Add("class", "sidebar1");
                Wizard wizard = Wizard1;

                //get the wizardstep
                WizardStep wizardStep1 = Wizard1.FindControl("WizardStep1") as WizardStep;
                //get the div control in the wizardstep and change its class
                HtmlGenericControl step1 = wizardStep1.FindControl("step1") as HtmlGenericControl;
                step1.Attributes.Add("class", "step1 ");
            }
            else
            {
                ul.Attributes.Add("class", "sidebar2");
                WizardStep         wizardStep2 = Wizard1.FindControl("WizardStep2") as WizardStep;
                HtmlGenericControl step2       = wizardStep2.FindControl("step2") as HtmlGenericControl;
                step2.Attributes.Add("class", "step2");
            }
        }
Пример #2
0
        public IList <object> GetListSelectedKeys(System.Web.UI.WebControls.ListView listView)
        {
            var res = new List <object>();

            foreach (var idx in ControlUtils.GetChildren <System.Web.UI.HtmlControls.HtmlInputCheckBox>(listView).Where(c => c.Checked && c.ID == "checkItem" && !String.IsNullOrEmpty(c.Value)).Select(c => Convert.ToInt32(c.Value)))
            {
                res.Add(listView.DataKeys[idx].Values.Count > 1 ? listView.DataKeys[idx].Values : listView.DataKeys[idx].Value);
            }
            return(res);
        }
Пример #3
0
        protected void perfumeList_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            //find the nested listview
            System.Web.UI.WebControls.ListView listView = e.Item.FindControl("ListView1") as System.Web.UI.WebControls.ListView;
            // find the name of current marca
            Label label = e.Item.FindControl("Label1") as Label;

            //get all the perfumes with the current marca
            //here I use linq , you could use other ways only if you could get the perfumes having the current marca
            listView.DataSource = table.AsEnumerable().Where(row => row["marca"] as string == label.Text).Select(row => new { name = row["name"], price = row["price"] }).ToList();
            listView.DataBind();
        }
Пример #4
0
        public int GetListViewRowCount(System.Web.UI.WebControls.ListView listView)
        {
            var pager = ControlUtils.GetChildren <DataPager>(listView).FirstOrDefault();

            if (pager != null)
            {
                return(pager.TotalRowCount);
            }
            if (listView.Items != null)
            {
                return(listView.Items.Count);
            }
            return(-1);
        }
        private void CarregarMensagens(TipoMensagemEnum tipoMensagem, ListView listView)
        {
            var mensagensSucesso = SessionHelper.ListMensagens.Where(m => m.TipoMensagem == tipoMensagem);

            if (mensagensSucesso.Any())
            {
                listView.Parent.Visible = true;

                listView.DataSource = mensagensSucesso;
                listView.DataBind();
            }
            else
                listView.Parent.Visible = false;
        }
        public static void DataBindLayoutTemplate(ListView listView)
        {
            listView.ThrowIfNull(() => new ArgumentNullException("listView"));

            // Create a databound layout template.
            var template = new Control();
            listView.LayoutTemplate.InstantiateIn(template);
            template.DataBind();

            // Remove the existing, non-databound layout template.
            listView.Controls.RemoveAt(0);

            // Add the databound layout template.
            listView.Controls.Add(template);
        }
Пример #7
0
        public static void ListViewToCSV(ListView myList, string filePath, bool includeHidden)
        {
            ////make header srting
            //StringBuilder result = new StringBuilder();
            //WriteCSVRow(result, listView.Columns.Count, i => includeHidden || listView.Columns[i].Width > 0, i => listView.Columns[i].Text);

            ////export data rows
            //foreach (var listItem in listView.Items)
            //    WriteCSVRow(result, listView.Columns.Count, i => includeHidden || listView.Columns[i].Width > 0, i => listItem.SubItems[i].Text);

            //File.WriteAllText(filePath, result.ToString());

            StringBuilder sb = new StringBuilder();
            foreach (ColumnHeader ch in myList.Columns)
            {
                sb.Append(ch.Text + ",");
            }
            sb.AppendLine();
            foreach (ListViewItem lvi in myList.Items)
            {
                foreach (ListViewItem.ListViewSubItem lvs in lvi.SubItems)
                {
                    if (lvs.Text.Trim() == string.Empty)
                        sb.Append(" ,");
                    else
                        sb.Append(lvs.Text + ",");
                }
                sb.AppendLine();
            }
            DialogResult dr = saveFileDialog1.ShowDialog();
            if (dr == DialogResult.OK)
            {
                StreamWriter sw = new StreamWriter(saveFileDialog1.FileName);
                sw.Write(sb.ToString());
                sw.Close();
            }
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderStateList"/> class.
        /// </summary>
        public OrderStateList()
        {
            this.availableStates = new System.Collections.Generic.List<StateModel>();

              this.stateDropDownList = new DropDownList
              {
            DataTextField = "Name",
            DataValueField = "Code",
            ID = "stateDropDownList"
              };
              this.substateContainer = new System.Web.UI.HtmlControls.HtmlGenericControl("ul")
              {
            ID = "SubstateContainer"
              };
              this.substateList = new ListView
              {
            ID = "SubstateList"
              };

              this.substateContainer.Attributes["class"] = "substates";

              this.substateList.LayoutTemplate = new SubstateListLayoutTemplate();
              this.substateList.ItemTemplate = new SubstateListItemTemplate(this);

              this.stateDropDownList.SelectedIndexChanged += this.StateDropDownListOnSelectedIndexChanged;
              this.stateDropDownList.DataBound += this.StateDropDownListOnDataBound;

              this.substateList.DataBinding += this.SubstateList_OnDataBinding;
        }
Пример #9
0
        protected override void CreateChildControls() {
            Controls.Clear();

            _listView = new ListView();
            Controls.Add(_listView);

            // Assign templates to the ListView
            PrepareTemplates();
        }
Пример #10
0
 private void setButtonWishVisible(ListView listView)
 {
     foreach (ListViewDataItem items in listView.Items)
     {
         if (items.ItemType == ListViewItemType.DataItem)
         {
             Button btnAdd = (Button)items.FindControl("btnAddWishlist") as Button;
             btnAdd.Visible = false;
         }
     }
 }
        private void LoopPrices( ListView lvCurrencies, long? countryId = null, long? countryRegionId = null )
        {
            foreach ( ListViewDataItem item in lvCurrencies.Items ) {
            long currencyId = long.Parse( ( item.FindControl<HiddenField>( "HdfId" ) ).Value );
            long? servicePriceId = item.FindControl<HiddenField>( "HdfPriceId" ).Value.TryParse<long>();
            decimal? price = ( item.FindControl<TextBox>( "TxtPrice" ) ).Text.ParseToDecimal();

            if ( servicePriceId != null ) {
              if ( price != null ) {
            ServicePrice servicePrice = paymentMethod.OriginalPrices.SingleOrDefault( p => p.Id == servicePriceId.Value );
            servicePrice.Value = price.Value;
              } else {
            paymentMethod.OriginalPrices.RemoveAll( p => p.Id == servicePriceId.Value );
              }
            } else {
              if ( price != null ) {
            paymentMethod.OriginalPrices.Add( countryId == null ? new ServicePrice( currencyId, price.Value ) : new ServicePrice( currencyId, price.Value, countryId.Value, countryRegionId ) );
              }
            }

              }
        }
        private Pane AddSettingList( int? languageId )
        {
            string strLanguageId = languageId != null ? languageId.Value.ToString() : string.Empty;

              Pane pane = new Pane();
              if ( languageId == null ) {
            pane.Text = CommonTerms.DefaultSettings;
              }

              ListView lvSettings = new ListView();
              lvSettings.ID = "LvSettings" + strLanguageId;
              lvSettings.ItemDataBound += lvSettings_ItemDataBound;
              lvSettings.ItemEditing += lvSettings_ItemEditing;
              lvSettings.ItemDeleting += lvSettings_ItemDeleting;
              lvSettings.LayoutTemplate = new LvSettingsLayoutTemplate();
              lvSettings.ItemTemplate = new LvSettingsItemTemplate();
              lvSettings.ItemPlaceholderID = "itemPlaceHolder";
              pane.Controls.Add( lvSettings );

              Panel pnlAddSetting = new Panel();
              pnlAddSetting.Style[ "clear" ] = "both;";
              pnlAddSetting.Style[ "float" ] = "left;";
              pane.Controls.Add( pnlAddSetting );

              Button btnAddSetting = new Button();
              btnAddSetting.Click += btnAddSetting_Click;
              btnAddSetting.Text = PaymentProviderTerms.AddSetting;
              btnAddSetting.CommandArgument = strLanguageId;
              pnlAddSetting.Controls.Add( btnAddSetting );

              return pane;
        }
 protected void Page_Init(object sender, EventArgs e)
 {
     this.NewestArticlesList = ListViewNewestArticles;
     
 }
Пример #14
0
		private List<int> GetEmailIDs(ListView listView)
		{
			var lst = new List<int>();
			foreach (var item in listView.Items)
			{
				foreach (var control in item.Controls)
				{
					var lblLetterLeadID = control as Label;
					if (lblLetterLeadID != null)
					{
						if (lblLetterLeadID.CssClass.Equals("lblLeadID"))
						{
							lst.Add(int.Parse(lblLetterLeadID.Text));
							break;
						}
					}
				}
			}
			return lst;
		}
Пример #15
0
        /// <summary>
        /// Sets datasource of listview.
        /// </summary>
        /// <remarks>
        /// Loads tags form Content Repository and adds the following properties of them to a datatable:
        /// DisplayName, Created By, Creation Date, Modification Date, Reference Count, Path, Is Blacklisted an Node ID.
        /// Sets this datatable as datasource to the listview.
        /// </remarks>
        private void SetDataSource()
        {
            var refCounts = TagManager.GetTagOccurrencies();

            var exprList = new ExpressionList(ChainOperator.And);

            exprList.Add(new TypeExpression(ActiveSchema.NodeTypes["Tag"], true));
            exprList.Add(new StringExpression(StringAttribute.Path, StringOperator.StartsWith, TagPath));

            var nq = new NodeQuery(exprList);

            var result = nq.Execute();

            var dt = new DataTable();
            _tagsInRepository = new List<string>();

            dt.Columns.AddRange(new[] { 
                                        new DataColumn("DisplayName", typeof(String)),
                                        new DataColumn("CreatedBy", typeof(String)), 
                                        new DataColumn("CreationDate", typeof(DateTime)), 
                                        new DataColumn("ModificationDate", typeof(DateTime)), 
                                        new DataColumn("RefCount", typeof(Int32)), 
                                        new DataColumn("Path", typeof(String)),
                                        new DataColumn("IsBlackListed", typeof(String)),
                                        new DataColumn("ID", typeof(Int32))
                                });

            foreach (var item in result.Nodes.ToList())
            {
                dt.Rows.Add(new object[]
                                {
                                    item.DisplayName,
                                    item.CreatedBy,
                                    item.CreationDate,
                                    item.ModificationDate,
                                    refCounts.ContainsKey(item.DisplayName) ? refCounts[item.DisplayName] : 0,
                                    item.Path, GetIsBlackListed(item.Id),
                                    Convert.ToInt32(item.Id)
                                });
                if (GetIsBlackListed(item.Id) == "No")
                    _tagsInRepository.Add(item.DisplayName);
            }

            _allTags = TagManager.GetAllTags(null, SearchPaths);

            dt.DefaultView.Sort = !String.IsNullOrEmpty(Request.QueryString["OrderBy"]) ? String.Concat(Request.QueryString["OrderBy"], " " + Request.QueryString["Direction"]) : "DisplayName ASC";

            _lv = FindControl("LVTags") as ListView;
            if (_lv != null)
            {
                _lv.DataSource = dt.DefaultView;
                _lv.DataBind();
            }
        }
Пример #16
0
 private void RefreshView(ListView listView)
 {
     foreach (ListViewItem items in listView.Items)
     {
         if (items.ItemType == ListViewItemType.DataItem)
         {
             Label labelId = (Label)items.FindControl("lblId");
             Label lbllWishListAdd = (Label)items.FindControl("lblWish");
             if (ConnectionClass.CheckWishList(Int32.Parse(labelId.Text), user_id) && Session["login"] != null)
             {
                 lbllWishListAdd.Visible = true;
             }
         }
     }
 }
 void RecreateListView(bool ifNotCreatedOnly) {
     if (ViewEditMode == ViewEditMode.Edit && (!ifNotCreatedOnly || listView == null)) {
         listView = null;
         if (CurrentObject != null) {
             listView = helper.CreateListView(CurrentObject);
         }
         Frame.SetView(listView);
     }
 }
Пример #18
0
        private IEnumerable <Column> GetSelectedColumns(WebControls.ListView listView)
        {
            var cols = new List <Column>();

            if (listView == null)
            {
                return(cols);
            }

            foreach (var c in listView.Items)
            {
                var cb          = c.FindControl("cbField") as CheckBox;
                var tb          = c.FindControl("tbWidth") as TextBox;
                var ha          = c.FindControl("ddHAlign") as DropDownList;
                var wm          = c.FindControl("ddWrap") as DropDownList;
                var lblFullName = c.FindControl("lblColumnFullName") as Label;
                var ind         = c.FindControl("ddIndex") as DropDownList;

                if ((cb == null) || !cb.Checked || lblFullName == null)
                {
                    continue;
                }

                var query = from FieldSetting f in AvailableFields
                            where f.FullName == lblFullName.Text
                            select f;

                if (query.Count() <= 0)
                {
                    continue;
                }

                var fs     = query.First();
                var newcol = new Column
                {
                    Title       = (string.IsNullOrEmpty(fs.DisplayName) ? fs.Name : fs.DisplayName),
                    FullName    = fs.FullName,
                    BindingName = fs.BindingName,
                    Index       = ind != null?Convert.ToInt32(ind.SelectedValue) : 1
                };

                if (tb != null)
                {
                    var colWidth = 0;
                    if (int.TryParse(tb.Text, out colWidth))
                    {
                        newcol.Width = colWidth;
                    }
                }

                if (ha != null)
                {
                    newcol.HorizontalAlign = ha.SelectedValue;
                }

                if (wm != null)
                {
                    newcol.Wrap = wm.SelectedValue;
                }

                //TODO: refactor this
                if (fs.BindingName == "GenericContent_DisplayName" ||
                    fs.BindingName == "GenericContent_Title" ||
                    fs.BindingName == "GenericContent_Name" ||
                    fs.BindingName == "ContentType_DisplayName" ||
                    fs.BindingName == "ContentType_Title" ||
                    fs.BindingName == "ContentType_Name")
                {
                    newcol.IsLeadColumn = true;
                    newcol.Icon         = fs.Icon;
                }

                cols.Add(newcol);
            }

            return(cols);
        }
 protected override void Dispose(bool disposing) {
     try {
         if (disposing) {
             if (newObjectWindowAction != null) {
                 newObjectWindowAction.Execute -= newObjectWindowAction_OnExecute;
                 newObjectWindowAction.CustomizePopupWindowParams -=
                     newObjectWindowAction_OnCustomizePopupWindowParams;
                 DisposeAction(newObjectWindowAction);
                 newObjectWindowAction = null;
             }
             if (newObjectViewController != null) {
                 newObjectViewController.ObjectCreating -= newObjectViewController_ObjectCreating;
                 newObjectViewController.ObjectCreated -= newObjectViewController_ObjectCreated;
                 newObjectViewController = null;
             }
             if (frame != null) {
                 frame.SetView(null);
                 frame.Dispose();
                 frame = null;
             }
             if (listView != null) {
                 listView.Dispose();
                 listView = null;
             }
             foreach (IObjectSpace createdObjectSpace in createdObjectSpaces) {
                 if (!createdObjectSpace.IsDisposed) {
                     createdObjectSpace.Dispose();
                 }
             }
             createdObjectSpaces.Clear();
             newObject = null;
             newObjectSpace = null;
         }
     } finally {
         base.Dispose(disposing);
     }
 }
Пример #20
0
        /// <summary>
        /// Adds the ListView control to the child controls.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            // The ListView is used to display the contents of the control
            _listView = new ListView();
            this.Controls.Add(_listView);

            // Assign templates to the ListView
            PrepareTemplates();
        }
Пример #21
0
        private void CreateControls()
        {
            var ctrl = Page.LoadControl(contentViewPath) as UserControl;
            Controls.Add(ctrl);

            inputFile = ctrl.FindControl("fuInputfile") as FileUpload;
            encodingSelector = ctrl.FindControl("ddlEncoding") as DropDownList;
            btnImport = ctrl.FindControl("btnImport") as Button;

            importedResultList = ctrl.FindControl("lvImported") as ListView;
            notImportedResultList = ctrl.FindControl("lvNotImported") as ListView;

            updateExisting = ctrl.FindControl("cbUpdateExisting") as CheckBox;
            importNew = ctrl.FindControl("cbImportNew") as CheckBox;

            pnlResults = ctrl.FindControl("pnlResults") as Panel;
            btnImport.Click += btnImport_Click;

            tbExclude = ctrl.FindControl("tbExclude") as TextBox;

            pnlError = ctrl.FindControl("pnlError") as Panel;
            lblError = ctrl.FindControl("lblError") as Label;
        }