示例#1
0
        /// <summary>
        /// This member overrides <see cref="DataGridColumn.InitializeCell"/>.
        /// </summary>
        /// <param name="cell">A <see cref="T:System.Web.UI.WebControls.TableCell"/> that represents the cell to reset.</param>
        /// <param name="columnIndex">The column number where the cell is located.</param>
        /// <param name="itemType">One of the <see cref="T:System.Web.UI.WebControls.ListItemType"/> values.</param>
        public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
        {
            base.InitializeCell(cell, columnIndex, itemType);

            switch (itemType)
            {
            case ListItemType.EditItem:
            case ListItemType.Item:
            case ListItemType.AlternatingItem:
            case ListItemType.SelectedItem:

                if (this.SelectionMode == ListSelectionMode.Multiple)
                {
                    ParticipantCheckBox selector = new ParticipantCheckBox();
                    selector.ID           = "RowSelectorColumnSelector";
                    selector.AutoPostBack = this.AutoPostBack;
                    cell.Controls.Add(selector);
                    if (AllowSelectAll)
                    {
                        RegisterForSelectAll(selector);
                    }
                    selector.ServerChange += new EventHandler(selector_ServerChange);
                }
                else
                {
                    ParticipantRadioButton selector = new ParticipantRadioButton();
                    selector.Name         = "RowSelectorColumnSelector";
                    selector.ID           = "RowSelectorColumnSelector";
                    selector.AutoPostBack = this.AutoPostBack;
                    cell.Controls.Add(selector);
                    selector.DataBinding  += new EventHandler(this.selectorDataBinding);
                    selector.ServerChange += new EventHandler(selector_ServerChange);
                }
                break;

            case ListItemType.Header:
                if (AllowSelectAll && this.SelectionMode == ListSelectionMode.Multiple)
                {
                    selectAllControl              = new SelectAllCheckBox();
                    selectAllControl.ID           = "RowSelectorColumnAllSelector";
                    selectAllControl.AutoPostBack = this.AutoPostBack;
                    RegisterSelectAllScript();

                    String currentText = cell.Text;
                    if (currentText != "")
                    {
                        cell.Text = "";
                    }
                    cell.Controls.Add(selectAllControl);
                    if (currentText != "")
                    {
                        cell.Controls.Add(new LiteralControl(currentText));
                    }
                }
                break;
            }
        }
示例#2
0
        //Delete All Templates
        public static void DeleteAllTemplates()
        {
            log4net.Config.XmlConfigurator.Configure();
            ILog logger = LogManager.GetLogger(typeof(MyProjectsPage));

            try
            {
                SelectAllCheckBox.Click();
                DeleteSelected.Click();
                bool status_of_deletealertpopup = DeleteAlertPopup.IsElementDisplayed();
                Assert.IsTrue(status_of_deletealertpopup);
                Wait.WaitVisible(ConfirmationMsgPopup, 10);
                Console.WriteLine("Confirmation message is " + ConfirmationMsgPopup.GetText());
            }
            catch (Exception e)
            {
                logger.Error("Delete All Template failed due to : " + e);
                //**Closing browser
                Driver.Quit();
                throw e;
            }
        }
示例#3
0
        public static void DismissPopupAllTemplate()
        {
            log4net.Config.XmlConfigurator.Configure();
            ILog logger = LogManager.GetLogger(typeof(MyProjectsPage));

            test = Base.extent.CreateTest("DismissPopupAllTemplate");
            try
            {
                SelectAllCheckBox.Click();
                DeleteSelected.Click();
                Wait.WaitVisible(DeleteAlertPopup, 10);
                Console.Write("Message from the Delete alert popup is " + DeleteAlertPopupMsg.GetText());
                DeleteAlertPopupNo.Click();
                Assert.IsTrue(ProjectsHeader.IsElementDisplayed());
            }
            catch (Exception e)
            {
                logger.Error("Dismiss PopupAll Template failed due to : " + e);
                //**Closing browser
                Driver.Quit();
                throw e;
            }
        }
示例#4
0
		/// <summary>
		/// This member overrides <see cref="DataGridColumn.InitializeCell"/>.
		/// </summary>
		public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) 
		{
			base.InitializeCell(cell, columnIndex, itemType);

			switch (itemType) 
			{
				case ListItemType.EditItem:
				case ListItemType.Item:
				case ListItemType.AlternatingItem:
				case ListItemType.SelectedItem:

					if ( this.SelectionMode == ListSelectionMode.Multiple ) 
					{
						ParticipantCheckBox selector = new ParticipantCheckBox();
						selector.ID = "RowSelectorColumnSelector";
						selector.AutoPostBack = this.AutoPostBack;
						cell.Controls.Add( selector );
						if ( AllowSelectAll ) 
						{
							RegisterForSelectAll( selector );
						}
						selector.ServerChange += new EventHandler(selector_ServerChange);
					} 
					else 
					{
						ParticipantRadioButton selector = new ParticipantRadioButton();
						selector.Name = "RowSelectorColumnSelector";
						selector.ID = "RowSelectorColumnSelector";
						selector.AutoPostBack = this.AutoPostBack;
						cell.Controls.Add( selector );
						selector.DataBinding += new EventHandler( this.selectorDataBinding );
						selector.ServerChange += new EventHandler(selector_ServerChange);
					}
					break;
				case ListItemType.Header:
					if ( AllowSelectAll && this.SelectionMode == ListSelectionMode.Multiple ) 
					{
						selectAllControl = new SelectAllCheckBox();
						selectAllControl.ID = "RowSelectorColumnAllSelector";
						selectAllControl.AutoPostBack = this.AutoPostBack;
						RegisterSelectAllScript();
						
						String currentText = cell.Text;
						if ( currentText != "" ) 
						{
							cell.Text = "";
						}
						cell.Controls.Add( selectAllControl );
						if ( currentText != "" ) 
						{
							cell.Controls.Add( new LiteralControl(currentText) );
						}
						
					}
					break;
			}
			
		}
示例#5
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            switch (rowState)
            {
                case DataControlRowState.Edit:
                case DataControlRowState.Normal:
                case DataControlRowState.Alternate:
                case DataControlRowState.Selected:

                    if (SelectionMode == ListSelectionMode.Multiple)
                    {
                        ParticipantCheckBox selector = new ParticipantCheckBox();
                        selector.ID = "RowSelectorColumnSelector";
                        selector.AutoPostBack = AutoPostBack;
                        cell.Controls.Add(selector);
                        if (AllowSelectAll)
                        {
                            RegisterForSelectAll(selector);
                        }
                        selector.ServerChange += new EventHandler(selector_ServerChange);
                    }
                    else
                    {
                        ParticipantRadioButton selector = new ParticipantRadioButton();
                        selector.Name = "RowSelectorColumnSelector";
                        selector.ID = "RowSelectorColumnSelector";
                        selector.AutoPostBack = AutoPostBack;
                        cell.Controls.Add(selector);
                        selector.DataBinding += new EventHandler(selectorDataBinding);
                        selector.ServerChange += new EventHandler(selector_ServerChange);
                    }
                    break;
            }

            if (cellType == DataControlCellType.Header)
            {
                if (AllowSelectAll && SelectionMode == ListSelectionMode.Multiple)
                {
                    selectAllControl = new SelectAllCheckBox();
                    selectAllControl.ID = "RowSelectorColumnAllSelector";
                    selectAllControl.AutoPostBack = AutoPostBack;
                    RegisterSelectAllScript();

                    String currentText = (cell == null) ? "" : cell.Text;
                    if (!string.IsNullOrEmpty(currentText))
                    {
                        cell.Text = "";
                    }
                    cell.Controls.Add(selectAllControl);
                    if (!string.IsNullOrEmpty(currentText))
                    {
                        cell.Controls.Add(new LiteralControl(currentText));
                    }
                }
            }
        }