/// Bind data to the control. public override void DataBind() { // Clear the child view state. if (this.HasChildViewState) { this.ClearChildViewState(); } // Let's not create the child controls. this.ChildControlsCreated = true; // Delete the rows from the table. this.rows_ = 0; this.Rows.Clear(); // Create the first row for the table. LogFormatRow row = this.NewRow(); // Initailize the data for this row. row.AddRange(this.formats_.ToArray()); row.SelectedValue = this.formats_[0].ID; // Increment the number of rows. this.rows_ = 1; }
public void IncreaseLogFormats() { // Create a new log format. this.EnsureChildControls(); LogFormatRow row = this.NewRow(); // Get the log formats from the last row. LogFormatRow lastrow = (LogFormatRow)this.Rows[this.rows_ - 1]; LogFormats formats = new LogFormats(lastrow.LogFormats.ToArray()); // Remove last row's selected log format from all rows. LogFormat format = lastrow.SelectedItem; formats.Remove(format); int lastindex = this.rows_ - 1; for (int i = 0; i < this.rows_; ++i) { // Get the current row. LogFormatRow currrow = (LogFormatRow)this.Rows[i]; // Remove the previously selected format from the row. if (i != lastindex) { currrow.Remove(format); } // Remove the newly selected format from the row. currrow.Remove(formats[0]); } // Initialize the contents of the row. row.AddRange(formats.ToArray()); row.SelectedValue = formats[0].ID; // Increment the row count. ++this.rows_; }