Adding new row to dataset

Posted by: skane-pagen on 8 September 2017, 3:00 pm EST

  • Posted 8 September 2017, 3:00 pm EST



    I’m a new user of the FarPoint Grid
    and have previously used the standard grid included in Visual Studio.



     



    I have connected my grid to a
    dataset and a datatable. The datatable has two columns that don’t allows null
    value and this is my problem.  



     



    I can load, edit and remove rows
    without any problem. But when I try to add a new row to the grid I receive warnings that two columns don’t allow null value. Same things happens if I use FpSpread1.ActiveSheet.AddRows
    or if I set the Sheet property DataAllowAddNew = True



     



    Is there any way to solve this?



  • Replied 8 September 2017, 3:00 pm EST

    Hello,

    Since there is a constraint on the DataSet that does not allow for null values, you would not be allowed to add blank rows and hence getting the warning.You can use the AddUnboundRows method to add blank rows to the bound Spread. You can refer to the following link that describes the same:

                         http://www.gcpowertools.com/help/spreadnet6/WF2/spwin-databind-unboundrow.html

    These rows would not be part of the DataSource,  Then, when you are ready to add the new rows to the DataSource, you would call the AddRowToDataSource method for each trow you want to add to the datasource.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur

  • Replied 8 September 2017, 3:00 pm EST



    Thank you for a quick reply. Now I know how to handle this and it works perfect.



Need extra support?

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

Learn More

Forum Channels