We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Add empty row un SfDataGrid for data entry

Hi there!

How could I do so SfDataGrid can have an empty row for data entry? I want one of the columns to be a combobox and the others just simple textboxes.

As far as I know, SfDataGrid in WPF needs to have a data binding unlike to WINFORMS that you can add columns without binding data to something.

In WINFORMS, I'm able to add columns and set the Allow AddRows property to start entering data using textbox and combobox column. How can I do the same practice

with SfDataGrid?

Thanks in advanced.

C.

5 Replies

SP Shobika Palani Syncfusion Team November 11, 2019 12:30 PM UTC

Hi Carlos,   
  
Thank you for contacting Syncfusion Support.   
  
SfDataGrid has built-in support to add new rows to the underlying collection. You can allow the addition of new rows in datagrid by specifying AddNewRowPosition. Please refer the below UG link.   
  
UG Link:     
  
Also please refer to our Dashboard sample for AddNewRow feature in the below location.  
  
DashBoard Installation Location:    
{InstalledLocation}\Syncfusion\WPF\{installed version}\SfGrid.WPF\Samples\AddNewRowDemo/CS    
   
Github location:    
   
If we have misunderstood your requirement, please get back to us with more details regarding your requirement.    
  
Regards,   
Shobika  



CA Carlos November 11, 2019 06:37 PM UTC

Thanks Shobika for your reply.

As I saw the link you provided, looks like it is mandatory to bind a collection to the SfDataGrid to add rows.

Is there a way to add rows without binding the control to a collection like I used to do it in WINFORMS?

Regards,
C.


SP Shobika Palani Syncfusion Team November 12, 2019 12:38 PM UTC

Hi Carlos,   
  
By default, SfDatagrid is a data bounded grid and without binding collection, you cannot add rows directly to the grid. It is because we processed the creation of view based solely on the bounded collection. However, you can set empty collection as the itemssource for datagrid and then add item to the grid to fulfill your requirement. For adding new rows.  
  
Please refer the below KB.   
  
KB Link:   
  
Please let us know, if you require any further other assistance on this.   
  
Regards,   
Shobika  



CA Carlos November 12, 2019 03:54 PM UTC

Thank you! It was very helpful. I had a hesitate thinking I was able to add rows without a binding collection but now you clarified to me.

Feel free to close this ticket.

Thanks again!


FP Farjana Parveen Ayubb Syncfusion Team November 13, 2019 05:27 AM UTC

Hi Carlos, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
  
Regards, 
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon