}//public static void PageBuild() /// <summary>PageBuildTextBox().</summary> public void PageBuildTextBox() { int dataTableCount = -1; int dataTableTotal = -1; int theWordIdColumnIndex = 0; DateTime dated = DateTime.Now; System.Web.UI.WebControls.Label label = null; String columnNameForeignKey = null; String exceptionMessage = null; String[] sourceName = null; String[] sourceSQL = null; String tableName = null; System.Web.UI.WebControls.TextBox textBox = null; XmlNodeList sourceXML = null; TheWord.SourceSQLQuery ( filenameConfigurationXml, ref exceptionMessage, ref sourceXML, ref sourceSQL, ref sourceName ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) if ( !Page.IsPostBack ) { theWord.DataSetInitialize ( databaseConnectionString, ref exceptionMessage, nodeRoot, sourceSQL, sourceName ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) }//if ( Page.IsPostBack ) UtilityXml.XmlDocumentNodeInnerText ( filenameConfigurationXml, ref exceptionMessage, TheWord.XPathColumnForeign, ref columnNameForeignKey ); dataTableTotal = theWord.DataSetTheWord.Tables.Count; linkButtonAdd = new System.Web.UI.WebControls.LinkButton[ dataTableTotal ]; for( dataTableCount = 0; dataTableCount < theWord.DataSetTheWord.Tables.Count; ++dataTableCount ) { theWord.DataSetTheWord.Tables[dataTableCount].TableName = sourceName[dataTableCount]; } dataTableCount = -1; foreach( DataTable dataTable in theWord.DataSetTheWord.Tables ) { ++dataTableCount; tableName = dataTable.TableName; PlaceHolderGridView.Controls.Add ( new LiteralControl ( "<b>" + tableName + "</b>" ) ); foreach(DataRow dataRow in dataTable.Rows) { foreach(DataColumn dataColumn in dataTable.Columns) { label = new System.Web.UI.WebControls.Label(); label.Id = "Label" + dataColumn.ColumnName; label.Text = dataColumn.ColumnName + ": "; PlaceHolderGridView.Controls.Add( label ); textBox = new System.Web.UI.WebControls.TextBox(); textBox.ID = "TextBox" + dataColumn.ColumnName; textBox.Text = dataRow[dataColumn].ToString(); PlaceHolderGridView.Controls.Add( textBox ); label = new System.Web.UI.WebControls.Label(); label.Text = "<br />"; PlaceHolderGridView.Controls.Add( label ); }//foreach(DataColumn dataColumn in dataTable.Columns) }//foreach(DataRow dataRow in dataTable.Rows) if ( dataTableCount == 0 ) { PlaceHolderGridView.Controls.Add ( new LiteralControl( "<br />" ) ); } else { linkButtonAdd[dataTableCount] = new System.Web.UI.WebControls.LinkButton(); linkButtonAdd[dataTableCount].ID = dataTableCount + "|" + tableName + "|" + "Add"; linkButtonAdd[dataTableCount].Text = " Add <br />"; // Register the event-handling method for the Click event. linkButtonAdd[dataTableCount].Click += new EventHandler(this.LinkButtonAdd_Click); PlaceHolderGridView.Controls.Add( linkButtonAdd[dataTableCount] ); } }//foreach( DataTable dataTable in theWord.DataSetTheWord.Tables ) }//public static void PageBuildTextBox()
}//Page_Load /// <summary>PageBuild().</summary> public void PageBuild() { int dataTableCount = -1; int dataTableTotal = -1; int theWordIdColumnIndex = 0; DateTime dated = DateTime.Now; System.Web.UI.WebControls.Label label = null; String columnNameForeignKey = null; String exceptionMessage = null; String[] sourceName = null; String[] sourceSQL = null; String tableName = null; System.Web.UI.WebControls.TextBox textBox = null; XmlNodeList sourceXML = null; TheWord.SourceSQLQuery ( filenameConfigurationXml, ref exceptionMessage, ref sourceXML, ref sourceSQL, ref sourceName ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) if ( !Page.IsPostBack ) { theWord.DataSetInitialize ( databaseConnectionString, ref exceptionMessage, nodeRoot, sourceSQL, sourceName ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) }//if ( Page.IsPostBack ) UtilityXml.XmlDocumentNodeInnerText ( filenameConfigurationXml, ref exceptionMessage, TheWord.XPathColumnForeign, ref columnNameForeignKey ); dataTableTotal = theWord.DataSetTheWord.Tables.Count; GridViewTheWord = new System.Web.UI.WebControls.GridView[ dataTableTotal ]; linkButtonAdd = new System.Web.UI.WebControls.LinkButton[ dataTableTotal ]; for( dataTableCount = 0; dataTableCount < theWord.DataSetTheWord.Tables.Count; ++dataTableCount ) { theWord.DataSetTheWord.Tables[dataTableCount].TableName = sourceName[dataTableCount]; } dataTableCount = -1; foreach( DataTable dataTable in theWord.DataSetTheWord.Tables ) { ++dataTableCount; GridViewTheWord[dataTableCount] = new System.Web.UI.WebControls.GridView(); tableName = dataTable.TableName; GridViewTheWord[dataTableCount].BorderWidth = 1; GridViewTheWord[dataTableCount].CellPadding = 1; GridViewTheWord[dataTableCount].DataSource = dataTable; GridViewTheWord[dataTableCount].AllowPaging = true; GridViewTheWord[dataTableCount].AllowSorting = true; GridViewTheWord[dataTableCount].AutoGenerateColumns = false; GridViewTheWord[dataTableCount].AutoGenerateDeleteButton = true; GridViewTheWord[dataTableCount].AutoGenerateEditButton = true; GridViewTheWord[dataTableCount].AutoGenerateSelectButton = true; switch ( DataColumnFieldGridView ) { case DataColumnField.Bound: foreach( DataColumn dataColumn in dataTable.Columns ) { BoundField boundField = null; boundField = new BoundField(); boundField.DataField = dataColumn.ColumnName; boundField.HeaderText = dataColumn.ColumnName; boundField.SortExpression = dataColumn.ColumnName; GridViewTheWord[dataTableCount].Columns.Add( boundField ); } break; case DataColumnField.Template: foreach( DataColumn dataColumn in dataTable.Columns ) { TemplateField templateField = null; //System.Web.UI.WebControls.Label label = null; templateField = new TemplateField(); templateField.HeaderText = dataColumn.ColumnName; templateField.SortExpression = dataColumn.ColumnName; //templateField.EditItemTemplate = new DataGridTemplate(ListItemType.EditItem, dataColumn.ColumnName); //templateField.FooterTemplate = new DataGridTemplate(ListItemType.Footer, dataColumn.ColumnName); //templateField.HeaderTemplate = new DataGridTemplate(ListItemType.Header, dataColumn.ColumnName); templateField.ItemTemplate = new DataGridTemplate(ListItemType.Item, dataColumn.ColumnName); GridViewTheWord[dataTableCount].Columns.Add( templateField ); } break; case DataColumnField.TextBox: PlaceHolderGridView.Controls.Add ( new LiteralControl ( "<b>" + tableName + "</b><br />" ) ); foreach( DataColumn dataColumn in dataTable.Columns ) { label = new System.Web.UI.WebControls.Label(); //label.Id = dataColumn.ColumnName; label.Text = dataColumn.ColumnName + ": "; PlaceHolderGridView.Controls.Add( label ); textBox = new System.Web.UI.WebControls.TextBox(); //textBox.Name = dataColumn.ColumnName; textBox.Text = dataColumn.ColumnName; PlaceHolderGridView.Controls.Add( textBox ); label = new System.Web.UI.WebControls.Label(); label.Text = "<br />"; PlaceHolderGridView.Controls.Add( label ); } break; } GridViewTheWord[dataTableCount].DataBind(); GridViewTheWord[dataTableCount].ID = tableName; theWordIdColumnIndex = UtilityDatabase.DataTableColumnIndex ( theWord.DataSetTheWord.Tables[tableName], columnNameForeignKey ); if ( DataColumnFieldGridView <= DataColumnField.Template ) { if ( theWordIdColumnIndex >= 0 ) { //UtilityDatabase.DataSetTableColumnVisible( GridViewTheWord[dataTableCount], theWordIdColumnIndex, false ); GridViewTheWord[dataTableCount].Columns[theWordIdColumnIndex].Visible = false; }//if ( theWordIdColumnIndex >= 0 ) //GridViewTheWord[dataTableCount].UserDeletingRow += new GridViewRowCancelEventHandler( GridViewDeleteEventArgs ); PlaceHolderGridView.Controls.Add ( new LiteralControl ( "<b>" + GridViewTheWord[dataTableCount].ID + "</b>" ) ); } if ( dataTableCount != 0 ) { linkButtonAdd[dataTableCount] = new System.Web.UI.WebControls.LinkButton(); linkButtonAdd[dataTableCount].ID = dataTableCount + "|" + tableName + "|" + "Add"; linkButtonAdd[dataTableCount].Text = "Add <br />"; // Register the event-handling method for the Click event. linkButtonAdd[dataTableCount].Click += new EventHandler(this.LinkButtonAdd_Click); PlaceHolderGridView.Controls.Add( linkButtonAdd[dataTableCount] ); } if ( DataColumnFieldGridView <= DataColumnField.Template ) { PlaceHolderGridView.Controls.Add(GridViewTheWord[dataTableCount]); PlaceHolderGridView.Controls.Add(new LiteralControl("<br />")); } }//foreach( DataTable dataTable in theWord.DataSetTheWord.Tables ) }//public static void PageBuild()