Esempio n. 1
0
  }//public void ButtonAdd_Click()

  /// <summary>ButtonNew_Click().</summary>
  public void ButtonNew_Click
  (
   Object sender, 
   EventArgs e
  )
  {
   string     tableName        = null;
   string     exceptionMessage = null;

   ArrayList  columnName       = null;

   try
   {
    UtilityDatabase.DataSetTableColumn
    (
     ref DatabaseSQLSelect,
     ref DataSetDataGrid,
     ref exceptionMessage,
     ref tableName,
     ref columnName
    );
    DataSourceBind();
   }
   catch ( Exception exception )
   {
    exceptionMessage = exception.Message;
   }
  }//public void ButtonNew_Click()
Esempio n. 2
0
  /// <summary>Page Load.</summary>
  public void Page_Load
  (
   object     sender, 
   EventArgs  e
  ) 
  {
   string              tableName                       = null;
   string              exceptionMessage                = null;

   ArrayList           columnName                      = null;
 
   ServerMapPath = this.MapPath("");
   if ( ServerMapPath != null)
   {
    FilenameConfigurationXml = ServerMapPath + @"\" + FilenameConfigurationXml;
   }//if ( ServerMapPath != null)

   UtilityXml.XmlDocumentNodeInnerText
   (
        FilenameConfigurationXml,
    ref exceptionMessage,         
        XPathDatabaseConnectionString,
    ref DatabaseConnectionString
   );

   UtilityXml.XmlDocumentNodeInnerText
   (
        FilenameConfigurationXml,
    ref exceptionMessage,         
        XPathSQLSelect,
    ref DatabaseSQLSelect
   );

   UtilityXml.XmlDocumentNodeInnerText
   (
        FilenameConfigurationXml,
    ref exceptionMessage,         
        XPathXmlStylesheet,
    ref FilenameXmlStylesheet
   );

   if ( exceptionMessage != null )
   {
    Feedback = exceptionMessage;
    return;
   }//if ( exceptionMessage != null )

   if ( !Page.IsPostBack )
   {
    UtilityDatabase.DataSetTableColumn
    (
     ref DatabaseSQLSelect,
     ref DataSetDataGrid,
     ref exceptionMessage,
     ref tableName,
     ref columnName
    );
    
    DataSourceBind();
 
   }//if ( !Page.IsPostBack )
   else
   {
    DataSetDataGrid = (DataSet) Session["DataSetDataGrid"];
   }//else ( Page.IsPostBack )
   
  }//Page_Load
  }//Page_Load

  /// <summary>PageBuild.</summary>
  public void PageBuild()
  {
   String              columnNameCurrent               =  null;
   String              exceptionMessage                =  null;
   String              tableName                       =  null;
   
   ArrayList           columnName                      =  null;

   GridViewURI = new System.Web.UI.WebControls.GridView();
    
   ServerMapPath = this.MapPath("");
   if ( ServerMapPath != null)
   {
    FilenameConfigurationXml = ServerMapPath + @"\" + FilenameConfigurationXml;
   }//if ( ServerMapPath != null)

   UtilityXml.XmlDocumentNodeInnerText
   (
        FilenameConfigurationXml,
    ref exceptionMessage,         
        XPathDatabaseConnectionString,
    ref DatabaseConnectionString
   );

   UtilityXml.XmlDocumentNodeInnerText
   (
        FilenameConfigurationXml,
    ref exceptionMessage,         
        XPathSQLSelect,
    ref DatabaseSQLSelect
   );

   UtilityXml.XmlDocumentNodeInnerText
   (
        FilenameConfigurationXml,
    ref exceptionMessage,         
        XPathXmlStylesheet,
    ref FilenameXmlStylesheet
   );

   if ( exceptionMessage != null )
   {
    Feedback = exceptionMessage;
    return;
   }//if ( exceptionMessage != null )

   UtilityDatabase.DataSetTableColumn
   (
    ref DatabaseSQLSelect,
    ref DataSetURI,
    ref exceptionMessage,
    ref tableName,
    ref columnName
   );
    
   DataSourceBind();

   foreach( object columnNameObject in columnName )
   {
    columnNameCurrent              =  ( String ) columnNameObject;
    BoundFieldURI                  =  new BoundField();
    BoundFieldURI.DataField        =  columnNameCurrent;
    BoundFieldURI.HeaderText       =  columnNameCurrent;
    BoundFieldURI.SortExpression   =  columnNameCurrent;
     
    if ( String.Compare( columnNameCurrent, "Dated", true ) == 0 )
    {
     //BoundFieldURI.DataFormatString =  "{T}";  //"{0:c}"
    }//if ( String.Compare( columnNameCurrent, "Dated", true ) == 0 )

    GridViewURI.Columns.Add( BoundFieldURI );
     
   }//foreach( object columnNameObject in columnName )

   GridViewURI.AllowSorting              =  true;
   GridViewURI.AllowPaging               =  true;
   GridViewURI.AutoGenerateColumns       =  false;
   GridViewURI.AutoGenerateEditButton    =  true;
   GridViewURI.AutoGenerateSelectButton  =  true;
   
   GridViewURI.BorderWidth               =  1;
   GridViewURI.CellPadding               =  1;
   GridViewURI.DataKeyNames              =  PrimaryKeyColumn;
   GridViewURI.ID                        =  "URI";
   GridViewURI.SelectedIndex             =  0;

   // Manually register the event-handling methods.

   GridViewURI.RowCancelingEdit    += new GridViewCancelEditEventHandler( GridViewURI_RowCancelingEdit );
   GridViewURI.RowEditing          += new GridViewEditEventHandler( GridViewURI_RowEdit );
   GridViewURI.RowUpdating         += new GridViewUpdateEventHandler( GridViewURI_RowUpdating );
   
   /*
   GridViewURI.CancelCommand += new GridViewCommandEventHandler(dataGrid_Cancel);
   GridViewURI.DeleteCommand += new GridViewCommandEventHandler(dataGrid_Delete);
   GridViewURI.EditCommand   += new GridViewCommandEventHandler(dataGrid_Edit);
   GridViewURI.UpdateCommand += new GridViewCommandEventHandler(dataGrid_Update);
   */
   
   PlaceHolderURI.Controls.Add( GridViewURI );
 
  }//PageBuild()