Пример #1
0
        private void selectorDataBinding(Object sender, EventArgs e)
        {
            ParticipantRadioButton radio = sender as ParticipantRadioButton;

            if (radio != null)
            {
                this.SetIndexValue(radio);
            }
        }
Пример #2
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;
            }
        }
Пример #3
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";
                    cell.Controls.Add(selector);
                    if (AllowSelectAll)
                    {
                        RegisterForSelectAll(selector);
                    }
                }
                else
                {
                    ParticipantRadioButton selector = new ParticipantRadioButton();
                    selector.Name = "RowSelectorColumnSelector";
                    selector.ID   = "RowSelectorColumnSelector";
                    cell.Controls.Add(selector);
                    selector.DataBinding += new EventHandler(this.selectorDataBinding);
                }
                break;

            case ListItemType.Header:
                if (AllowSelectAll && this.SelectionMode == ListSelectionMode.Multiple)
                {
                    selectAllControl    = new System.Web.UI.HtmlControls.HtmlInputCheckBox();
                    selectAllControl.ID = "RowSelectorColumnAllSelector";
                    ApplyScriptToSelectAllCheckBox();
                    RegisterSelectAllScript();
                    cell.Controls.Add(selectAllControl);
                }
                break;
            }
        }
Пример #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));
                    }
                }
            }
        }
Пример #6
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";
                        cell.Controls.Add( selector );
                        if ( AllowSelectAll ) {
                            RegisterForSelectAll( selector );
                        }
                    } else {
                        ParticipantRadioButton selector = new ParticipantRadioButton();
                        selector.Name = "RowSelectorColumnSelector";
                        selector.ID = "RowSelectorColumnSelector";
                        cell.Controls.Add( selector );
                        selector.DataBinding += new EventHandler( this.selectorDataBinding );
                    }
                    break;
                case ListItemType.Header:
                    if ( AllowSelectAll && this.SelectionMode == ListSelectionMode.Multiple ) {
                        selectAllControl = new System.Web.UI.HtmlControls.HtmlInputCheckBox();
                        selectAllControl.ID = "RowSelectorColumnAllSelector";
                        ApplyScriptToSelectAllCheckBox();
                        RegisterSelectAllScript();
                        cell.Controls.Add( selectAllControl );
                    }
                    break;
            }
        }