Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Datatable from Another Datatable

Status
Not open for further replies.

jtrembla

ISP
Jul 6, 2006
104
US
ok here is my initial problem.



I populated a grid with a datatable (from a stored proc that is using 2 tables and pivots them) and when a user makes a change to a cell value the backend tables gets updated by running a transaction, so all the rows are recalculated. However, if I rebind the grid to the original datatable the grid gets redrawn. I cannot have this happen, so I decided to through in a middle datatable, since the only way to update the grid without redrawing it is do update the row object from the initial datatable. My question is, does anyone know how I can easily updated the initial datatable with the values from the new one, the rows never get added or deleted, so it is strictly an updated. Here is my code thus far,

Code:
 public void UpdateDataTable()
        {


            // Get the data table that will be modified.
            DataTable population = dtPopulation;
            
            //New Datatable with new values updated from the database
            DataTable dtUpdated = LoadPopInGrid(IftProperties.IFTNo, IftProperties.Version, "PopIn_Pivot");
            
            //Set Primary Key (same primary key I set on the dtPopulation datatable
            DataColumn[] colPk = new DataColumn[2];
            colPk[0] = dtUpdated.Columns["EpiSort"];
            colPk[1] = dtUpdated.Columns["ctOrder"];
            dtUpdated.PrimaryKey = colPk;

           
            // Need to Update the Orginal Datatable
          


            // Refresh grid, this does not collapse or redraw grid
            this.ultraGrid1.Rows.Refresh(RefreshRow.ReloadData);
            
        }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top