Any Alternative code in FarPoint

Posted by: kiran-fp on 8 September 2017, 1:56 pm EST

  • Posted 8 September 2017, 1:56 pm EST

    Hi
     
    I’ve bound Dataset to the spread using the DataSource Property.if i paste any data from excel sheet to Forpoint spread sheet,I need to call the below code to get the Modified records.


    DataTable datatable = (DataTable)fpspread1.ActiveSheet.DataSource;
    foreach (DataRow dr in datatable.Rows)
                    {
                        dr.EndEdit();
                    }


    DataRow[] modRows = dt.Select("", "", DataViewRowState.ModifiedCurrent);


    My question is How can we change the above code to work more efficiently?( if we paste only few rows why we should call endedit in all rows)


    appreciate your reply


    Regards
    Kirankumar S

  • Replied 8 September 2017, 1:56 pm EST

     


    Hello Kirankumar S,


    EndEdit( ) pushes changes since the last BeginEdit(change) or AddNew call into the underlying object.We don't need to call EndEdit( ) in all rows whereas we will need to call the EndEdit method on each of the DataRow objects that are changed by the copy.This make the changes to be updated in the DataSource.Below is the code snippet to do the same,


    Dim dt as DataTable = CType(FpSpread1.DataSource, DataSet).Tables(0)


    For i as integer = 0 to numRowsAffected


    dt.Rows(FpSpread1.Sheets(0).ActiveRowIndex + i).EndEdit


    Next


     


    I hope it will help you.


    Regards,


     

  • Replied 8 September 2017, 1:56 pm EST

    Dear Deepak Sharma
      Thanks for your replay.How we can know about the numRowsAffected,since we copy and paste data from excel sheet.Is there any event available in farpoint to know about the numRowsAffected.


    Thanks


    Regards


    Kirankumar S

  • Replied 8 September 2017, 1:56 pm EST

    Hello Kiran,


    Please have a look at thread , where I got this code from.Hope it will help you.


     


     


    Regards,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels