How add new row programmatically in SfDataGrid ?
Hello Syncfusion team.
for example I add new col:
Dim col As New Syncfusion.UI.Xaml.Grid.GridTextColumn
col.HeaderText = "test col"
sfGrid.Columns.Add(col)
col.HeaderText = "test col"
sfGrid.Columns.Add(col)
how to add a row in this column?
Thanks!
SIGN IN To post a reply.
6 Replies
JG
Jai Ganesh S
Syncfusion Team
October 10, 2016 10:47 AM UTC
Hi Azem,
You can achieve your requirement for adding a new row at rime like blow,
|
private void Button_Click(object sender, RoutedEventArgs e)
{
(this.sfGrid.DataContext as UserInfoViewModel).UserDetails.Add(new UserInfo() { UserId=4001, Name="George", DateofBirth=DateTime.Now, City="Kolalambur",Salary=52000 });
} |
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataGridDemo-339837510.zip
Also we already have a kb to add the new row programmatically,
Kb Link:
https://www.syncfusion.com/kb/5918/how-to-do-addnewrow-operations-programmatically-in-the-sfdatagrid
Regards,
Jai Ganesh S
Hi Azem,You can achieve your requirement for adding a new row at rime like blow,
private void Button_Click(object sender, RoutedEventArgs e){(this.sfGrid.DataContext as UserInfoViewModel).UserDetails.Add(new UserInfo() { UserId=4001, Name="George", DateofBirth=DateTime.Now, City="Kolalambur",Salary=52000 });}Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataGridDemo-339837510.zipAlso we already have a kb to add the new row programmatically,Kb Link:https://www.syncfusion.com/kb/5918/how-to-do-addnewrow-operations-programmatically-in-the-sfdatagridRegards,Jai Ganesh S
Hello, Syncfusion team!
necessarily must be the source in SfDataGrid?
Thanks!
Hi Azem,You can achieve your requirement for adding a new row at rime like blow,
private void Button_Click(object sender, RoutedEventArgs e){(this.sfGrid.DataContext as UserInfoViewModel).UserDetails.Add(new UserInfo() { UserId=4001, Name="George", DateofBirth=DateTime.Now, City="Kolalambur",Salary=52000 });}Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataGridDemo-339837510.zipAlso we already have a kb to add the new row programmatically,Kb Link:https://www.syncfusion.com/kb/5918/how-to-do-addnewrow-operations-programmatically-in-the-sfdatagridRegards,Jai Ganesh SHello, Syncfusion team!necessarily must be the source in SfDataGrid?Thanks!
I want to programmatically create a rows in SfDataGrid.
creating classes (collections) are not suitable for me (at the moment).
JG
Jai Ganesh S
Syncfusion Team
October 17, 2016 11:44 AM UTC
Hi Azem,
We cannot understand your requirement clearly. But we suspect that you want to add the new row at run time without using the Collection. This requirement can be achieved in SfCellGrid by inserting the rows at runtime like below,
|
private void Button_Click(object sender, RoutedEventArgs e)
{
//To insert rows (Param : 5 => insert row index , 2=> number of rows to be inserted)
this.cellGrid.Model.InsertRows(5, 2);
} |
Regards,
Jai Ganesh S
Hi Azem,We cannot understand your requirement clearly. But we suspect that you want to add the new row at run time without using the Collection. This requirement can be achieved in SfCellGrid by inserting the rows at runtime like below,
private void Button_Click(object sender, RoutedEventArgs e){//To insert rows (Param : 5 => insert row index , 2=> number of rows to be inserted)this.cellGrid.Model.InsertRows(5, 2);}Regards,Jai Ganesh S
exactly what is needed!
Thanks!
JG
Jai Ganesh S
Syncfusion Team
October 18, 2016 07:14 PM UTC
Hi Azem,
Thank you for the update.
Please let us know if you need further assistance on this.
Regards,
Jai Ganesh S
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
AZ Azem
- Oct 8, 2016 06:34 PM UTC
- Oct 18, 2016 07:14 PM UTC