Beispiel #1
0
 /// <summary>
 /// Handles the on data bound.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param>
 internal void HandleOnDataBound(object sender, MergePersonFieldRowEventArgs e)
 {
     if (this.DataBound != null)
     {
         this.DataBound(sender, e);
     }
 }
Beispiel #2
0
            /// <summary>
            /// Handles the DataBinding event of the cell control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void cell_DataBinding(object sender, EventArgs e)
            {
                DataControlFieldCell cell = sender as DataControlFieldCell;
                var row = cell.DataItemContainer as GridViewRow;

                Literal         contentHtmlLiteral          = cell.FindControl($"contentHtmlLiteral_{MergePersonField.PersonId}") as Literal;
                Panel           selectionControlContainer   = cell.FindControl($"selectionControlContainer_{MergePersonField.PersonId}") as Panel;
                RockCheckBox    selectionControlCheckbox    = selectionControlContainer.FindControl($"selectionControlCheckbox_{MergePersonField.PersonId}") as RockCheckBox;
                RockRadioButton selectionControlRadioButton = selectionControlContainer.FindControl($"selectionControlRadioButton_{MergePersonField.PersonId}") as RockRadioButton;

                MergePersonFieldRowEventArgs mergePersonFieldRowEventArgs = new MergePersonFieldRowEventArgs(row, MergePersonField);

                MergePersonField.HandleOnDataBound(sender, mergePersonFieldRowEventArgs);

                if (mergePersonFieldRowEventArgs.ContentDisplayType == ContentDisplayType.ContentWrapper)
                {
                    contentHtmlLiteral.Visible       = true;
                    contentHtmlLiteral.Text          = $"<div class='merge-property-value'>{mergePersonFieldRowEventArgs.ContentHTML}</div>";
                    selectionControlCheckbox.Text    = null;
                    selectionControlRadioButton.Text = null;
                }
                else
                {
                    contentHtmlLiteral.Visible       = false;
                    selectionControlCheckbox.Text    = mergePersonFieldRowEventArgs.ContentHTML;
                    selectionControlRadioButton.Text = mergePersonFieldRowEventArgs.ContentHTML;
                }

                selectionControlCheckbox.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.Checkbox;
                selectionControlCheckbox.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.RadioButton;
                selectionControlRadioButton.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.GroupName = $"selectionControlRadioButtonGroup_{row.RowIndex}";
            }