Hi,
I have grid with 50 columns, I am binding to webdatagrid with 3 rows by using dataset. This grid contains, textbox, dropdown and datapicker. I want to create new empty row by clicking Button in server side. While saving tab, I have to loop all rows (existing modified rowns and newly created row) save to database.
I am looking for sample code for this scenario.
Questions?
Is is necessity put dataset in Session ? While creating new row, do we need to mention all 50 columns in datarow? I would like to get example as soon as possible.
Thank you.
Hello InfraOracle,
You posted this thread in “UltraWebGrid” section but you mention “WebDataGrid” control so I will propose that you are using our new Aikido grid.
If this is the case I can suggest you to use grid’s “RowAdding” behavior by which you can position empty row at bottom or top of the grid - http://es.infragistics.com/products/aspnet/sample/data-grid/add-new-row-basic-features
This behavior will let you add needed rows to the grid automatically on “Enter” or “Tab” (commits data when tab-out the last cell) key.
If you have different scenario let me know.
Thank you for your reply. I have seen the following link before I sent you email http://es.infragistics.com/products/aspnet/sample/data-grid/add-new-row-basic-features . This link is not useful for my scenario. Anyways.. I would like to add, save, copy and delete functionality by using buttons not with RowAdding.
I have 50 columns in a grid, How can I create new empty row by clicking button? As well as can you provide me code for delete client side by clicking row?
Can you please share the best code for this scenario.
Thanks for your reply. Actually I have seen this example. but this is not answer for my question. Our existing application was implemented by using Infragistics 2006. Now we are planing to upgrade Infragistics 2006 to 2012.1. We are facing some issues with Add, Delete functionality in a webdatagrid.
Infragistics 2006 (Working Code)
Grid has 50 columns
var oGrid=igtbl_getGridById('uwgGrid'); igtbl_addNew('uwgGrid',0);
var newrow=oGrid.Rows.getRow(oGrid.Rows.length-1);
Infragistics 2012.1
var grid = $find("WebDataGrid1");
// Create array of cell values for all values that cannot be null.
var row = new Array("CustomerID", "CompanyName");
// Add row.
grid.get_rows().add(row);
I am looking for best example without mention 50 columns in a array.
Questions
1. If I want to mention all 50 columns in a array, what is the reason?
2. I do have some hidden columns and unbound columns, do I need to mention in array?
However, for me not working with with the proposed solution.
Can you please give me a best solution.
Thank you
You can add new row either by modifying the grid Data Source or from Client-Side (recommended approach).
In order to add row from Client-Side you should use grid “add()” Client function and provide as parameter array with values:
var grid = $find("WebDataGrid1"); // Create array of cell values for all values that cannot be null. var row = new Array("CustomerID", "CompanyName"); // Add row. grid.get_rows().add(row);
http://help.infragistics.com/NetAdvantage/ASPNET/2012.1/CLR4.0/?page=WebDataGrid_Row_Adding.html
In order to delete row on Client you can use rows collection “remove()” function like this:
// remove first row grid.get_rows().remove(grid.get_rows().get_row(0));
// remove first row
grid.get_rows().remove(grid.get_rows().get_row(0));
I hope that this information will help you in achieving the needed functionality.