// 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); } } }