Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3555
reloading grid when copying pasting multiple values from excel...Might be ADO issue...
posted
I think my issue has to do with the aftercellupdate event. If I paste one
value everything works great. If I paste 3 values it does not return what
is expected. Anyone good with data tables?


private void ultraGridPop_AfterCellUpdate(object sender, CellEventArgs e)

{

System.Diagnostics.Debug.Write(e.Cell.Row.Index.ToString() + "\n");


//Change Saved State

IftProperties.IsSaved = false;

UltraGrid ugrid = this.ultraGridPop;

int EpiSort = Convert.ToInt32(ugrid.ActiveCell.Row.Cells["EpiSort"].Value);

String Country =
Convert.ToString(ugrid.ActiveCell.Row.Cells["Country"].Value);

int Year = Convert.ToInt32(ugrid.ActiveCell.Column.Header.Caption);

String Pop = Convert.ToString(ugrid.ActiveCell.Row.Cells["Pop"].Value);

decimal? Value = null;

if (e.Cell.Value != DBNull.Value)

{

Value = Convert.ToDecimal(e.Cell.Value);

}

DatabaseImplementation.UpdatePopIn(IftProperties.IFTNo,
IftProperties.Version,

EpiSort, Country, Year, Pop, Value);

//Call stored Procedure that recalculates values

//New Datatable with new values updated from the database transaction

DataTable dtUpdated = new DataTable();

dtUpdated = DatabaseImplementation.LoadPopInGrid(IftProperties.IFTNo,
IftProperties.Version, "PopIn_Pivot");

//Merge changes

popDataTable.Merge(dtUpdated, false, MissingSchemaAction.AddWithKey);

// Refresh grid, this does not redraw grid

ugrid.Rows.Refresh(RefreshRow.ReloadData);



}
  • 3555
    Verified Answer
    posted
    dam I am getting good, lol. I figured it out, I should be using the e.cell
    object instead of ugrid.ActiveCell, the activecell does not change when u
    paste....
    wrote in message news:14801@forums.infragistics.com...
    >I think my issue has to do with the aftercellupdate event. If I paste one
    > value everything works great. If I paste 3 values it does not return what
    > is expected. Anyone good with data tables?
    >
    >
    >
    >
    > private void ultraGridPop_AfterCellUpdate(object sender, CellEventArgs e)
    >
    >
    > {
    >
    >
    > System.Diagnostics.Debug.Write(e.Cell.Row.Index.ToString() + "\n");
    >
    >
    >
    > //Change Saved State
    >
    >
    > IftProperties.IsSaved = false;
    >
    >
    > UltraGrid ugrid = this.ultraGridPop;
    >
    >
    > int EpiSort =
    > Convert.ToInt32(ugrid.ActiveCell.Row.Cells["EpiSort"].Value);
    >
    >
    > String Country =
    >
    > Convert.ToString(ugrid.ActiveCell.Row.Cells["Country"].Value);
    >
    >
    > int Year = Convert.ToInt32(ugrid.ActiveCell.Column.Header.Caption);
    >
    >
    > String Pop = Convert.ToString(ugrid.ActiveCell.Row.Cells["Pop"].Value);
    >
    >
    > decimal? Value = null;
    >
    >
    > if (e.Cell.Value != DBNull.Value)
    >
    >
    > {
    >
    >
    > Value = Convert.ToDecimal(e.Cell.Value);
    >
    >
    > }
    >
    >
    > DatabaseImplementation.UpdatePopIn(IftProperties.IFTNo,
    >
    > IftProperties.Version,
    >
    >
    > EpiSort, Country, Year, Pop, Value);
    >
    >
    > //Call stored Procedure that recalculates values
    >
    >
    > //New Datatable with new values updated from the database transaction
    >
    >
    > DataTable dtUpdated = new DataTable();
    >
    >
    > dtUpdated = DatabaseImplementation.LoadPopInGrid(IftProperties.IFTNo,
    >
    > IftProperties.Version, "PopIn_Pivot");
    >
    >
    > //Merge changes
    >
    >
    > popDataTable.Merge(dtUpdated, false, MissingSchemaAction.AddWithKey);
    >
    >
    > // Refresh grid, this does not redraw grid
    >
    >
    > ugrid.Rows.Refresh(RefreshRow.ReloadData);
    >
    >
    >
    >
    > }
    >