Can anyone provide a summary or sample of how to accompilsh this? I am using the row edit templates for updating rows and this works fine but how can I duplicate this functionality for adding rows?
Thanks Sarita. You were very helpful.
It works now. Now I just have to move this to a user control and get it to work.
Hi,
Both of these events are client side events. The Server side UpdateRow event must be handled for this purpose. This event can be located from the provided list of events (not the client side events under DisplayLayout). Please open the Properties Window for ultraWebGrid and click on the events and navigate to this "UpdateRow" event and double click on it. It creates the signature in the code behind page. The signature in the should look as follows:
{
}
If the datasource is updating itself then you don't have to add any code here. To update the datasource we need to do a page postback and the processUpdateRow method from the client side causes this postback.
Hope this helps.
Thanks
I am handling the update from the datasource not the manual method. These events both fire and the grid is updated but it is still not updating the database.
function UltraWebGrid1_AfterRowTemplateCloseHandler(gridName, rowId, bSaveChanges){ debugger;
try { var row = igtbl_getRowById(rowId); row.processUpdateRow(true); } catch ( err ) { var txtMessage = document.title + " - Error in UltraWebGrid1_AfterRowDeletedHandler()\n" + err.description ; alert( txtMessage ) ; }
function UltraWebGrid1_AfterRowUpdateHandler(gridName, rowId){ debugger;
try { var oGrid = igtbl_getGridById(gridName); igtbl_doPostBack(gridName); } catch ( err ) { var txtMessage = document.title + " - Error in UltraWebGrid1_AfterRowDeletedHandler()\n" + err.description ; alert( txtMessage ) ; }
In this case, I think we have to handle the event AfterRowTemplateCloseHandler on the client side and then call the UpdateRow event from the server. Here is how the AfterRowTemplateCloseHandler should look like:
function UltraWebGrid1_AfterRowTemplateCloseHandler(gridName, rowId, bSaveChanges)
The key here is the method processUpdateRow method on the UltraWebGrid row. This fires the UpdateRow event in the server and thus the DataSource gets updated. Even though you are inserting a new row, it should be handled with the UpdateRow event.
If you are using DataSet to update the database, then please visit the following link, which explains how to do it with step by step example.
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebGrid_Updating_Data_with_a_Data_Set.html
I hope this helps.
The only problem I am having is that I can't detemine which event to handle after the insert or why no data is being inserted.
The UltraWebGrid1_AfterRowInsertHandler fires when I hit the Add New Box button but should it be?? I think the grid fails on insert becaue the row is empty.
UltraWebGrid1_TemplateUpdateCellsHandler fires after clicking the Ok button on the row edit template. From within the UltraWebGrid1_TemplateUpdateCellsHandler event I issue a postback but nothing gets inserted into the database. And the sqldatasource1_inserted event is never fired.
If I remove the UltraWebGrid1_TemplateUpdateCellsHandler and use an imagebutton to cause postback the record still is NOT inserted.
Updates and Deletes work fine.
What am I missing?