/// <summary> /// Gather the values of the prompted columns. /// </summary> /// <param name="InPanel"></param> /// <returns></returns> private AcNamedValues GatherColumnValues(AcTable InPanel) { AcNamedValues ht = new AcNamedValues( ); foreach (AcTableRow row in InPanel.Controls) { if (row.Controls.Count == 2) { AcTableCell cell00 = (AcTableCell)row.Controls[0]; AcTableCell cell01 = (AcTableCell)row.Controls[1]; if (cell01.Controls.Count == 1) { string columnValue = null; string columnName = cell00.Text; Control entryControl = cell01.Controls[0]; if (entryControl is TextBox) { TextBox tb = (TextBox)entryControl; columnValue = tb.Text; } else { DropDownList ddl = (DropDownList)entryControl; columnValue = ddl.SelectedValue; } ht.Add(columnName, columnValue); } } } return(ht); }
private Hashtable GatherColumnInput(AcTable InPanel) { Hashtable ht = new Hashtable( ); foreach (AcTableRow row in InPanel.Controls) { if (row.Controls.Count == 2) { AcTableCell cell00 = (AcTableCell)row.Controls[0]; AcTableCell cell01 = (AcTableCell)row.Controls[1]; if (cell01.Controls.Count == 1) { TextBox tb = (TextBox)cell01.Controls[0]; string ColumnName = cell00.Text; string ColumnValue = tb.Text; ht.Add(ColumnName, ColumnValue); } } } return(ht); }
// create the property panel as a table. The panel contains each column // being prompted. private void CreatePropertyPanel(AcTable InPanel) { AcTableRow row; AcTableCell cell; string columnValue; DataRow rowrow = null; DataTable rowtbl = null; // create the property panel as a table. InPanel.AddStyle("background-color", "lightgrey") .AddStyle("font-family", "Verdana, Arial") .AddStyle("border-color", "white"); // first row holds the property panel title InPanel.AddNewRow().AddNewCell() .AddAttribute("ColSpan", "2") .AddStyle("text-align", "center") .SetText(Title); // build a dataset holding the single row to be prompted. if ((ActionCode != ActionCode.Add) && (RowSelect != null)) { DataSet rowds = TableRowToDataSet(); rowtbl = rowds.Tables[0]; rowrow = rowtbl.Rows[0]; } foreach (ColumnPrompt column in Columns) { // add a row to the panel grid for each column in the table row being prompted. // foreach ( DataColumn column in rowtbl.Columns ) // { string columnName = column.ColumnName; columnValue = null; // AcColumnInfo of the column. AcColumnInfo info = null; if ((ColumnInfo != null) && (ColumnInfo.ContainsKey(columnName))) { info = ColumnInfo[columnName]; } // get ColumnPrompt of this column. // ( either default or the entry from mColumns collection ) // if ( Columns.Count == 0 ) // cp = new ColumnPrompt( ColumnName ) ; // else // cp = FindColumnPrompt( ColumnName ) ; // if ( cp == null ) // continue ; // add an AcTableRow to the panel AcTable row = InPanel.AddNewRow(); // column prompt text string headingText = columnName; if ((info != null) && (info.HeadingText != null)) { headingText = info.HeadingText; } // first column is the column prompt text row.AddNewCell() .AddStyle("padding-right", "2%") .SetText(headingText); // second column is the column value. // Get the value from either the sql selected row ( see RowSelect property ) // or the InputColumnValues ColumnName/ColumnValue dictionary. cell = row.AddNewCell(); if (rowrow != null) { columnValue = rowrow[columnName].ToString(); } else if (mInputColumnValues != null) { columnValue = mInputColumnValues[columnName]; } if ((info != null) && (info.AllowedValues != null)) { DropDownList ddl = new DropDownList(); foreach (string alwvlu in info.AllowedValues) { ddl.Items.Add(alwvlu); } cell.Controls.Add(ddl); } else if (AlwChg == true) { TextBox tb = new TextBox(); tb.Text = columnValue; cell.Controls.Add(tb); } else { cell.AddStyle("padding-right", "1%") .SetText(columnValue); } } }
// create the property panel as a table. The panel contains each column // being prompted. private void CreatePropertyPanel(AcTable InPanel) { AcTableRow row; AcTableCell cell; // create the property panel as a table. InPanel.AddStyle("background-color", "lightgrey") .AddStyle("font-family", "Verdana, Arial") .AddStyle("border-color", "white"); // first row holds the property panel title InPanel.AddNewRow( ).AddNewCell( ) .AddAttribute("ColSpan", "2") .AddStyle("text-align", "center") .SetText(Title); // build a dataset holding the single row to be prompted. DataSet rowds = TableRowToDataSet( ); DataTable rowtbl = rowds.Tables[0]; // add a row to the panel grid for each column in the table row being prompted. DataRow rowrow = rowtbl.Rows[0]; foreach (DataColumn column in rowtbl.Columns) { string ColumnName = column.ColumnName; ColumnPrompt cp = null; // get ColumnPrompt of this column. // ( either default or the entry from mColumns collection ) if (Columns.Count == 0) { cp = new ColumnPrompt(ColumnName); } else { cp = FindColumnPrompt(ColumnName); } if (cp == null) { continue; } // add an AcTableRow to the panel AcTable row = InPanel.AddNewRow( ); // first column is the column prompt text row.AddNewCell( ) .AddStyle("padding-right", "2%") .SetText(ColumnName); // second column is the column value cell = row.AddNewCell( ); string ColumnValue = rowrow[ColumnName].ToString( ); if (AlwChg == true) { TextBox tb = new TextBox( ); tb.Text = ColumnValue; cell.Controls.Add(tb); } else { cell.AddStyle("padding-right", "1%") .SetText(ColumnValue); } } }