As a programmer who wears many hats I only get to work in the .net environment using the infragistics tools every blue moon. This is something I've known how to do once but can't figure out how to do it now. I'm using ultrawebgrid Version=7.1.20071.1050 and VS 2003 in clr 1.1. Anyway...
I'm using several ultrawebgrids already on a page and I only want them to update batch, not update after every row is added or modified. I've managed to do that. NOW I have to add another grid to a page and I want the same behavior but I can't seem to find how to keep it from doing a postback after every row is changed. I know this is simple but I somehow blocked on this.
Please help and thanks for your patience with some one out of the loop and behind the curve.
Actually, after I typed this I realized that there are a few other details I left out. In any case, regardless of the type of updates that you want to do, you need to set some properties that tell the grid to allow updates, additions, and deletions in the first place. You can do this in code or in the designer. If you do it in code and you are data binding, it makes a lot of sense to use the InitializeLayout event. The properties you need to set are on the DisplayLayout object:
e.Layout.AllowUpdateDefault = AllowUpdate.Yes;
e.Layout.AllowAddNewDefault = AllowAddNew.Yes;
e.Layout.AllowDeleteDefault = AllowDelete.Yes;
In the InitializeLayout event, e.Layout is the same as typing this.UltraWebGrid1.DisplayLayout (or Me.UltraWebGrid1.DisplayLayout in VB). Additionally, you can set these properties on an individual band level for hierarchical grids:
e.Layout.Bands[0].AllowAdd = AllowAddNew.Yes;
e.Layout.Bands[0].AllowDelete = AllowDelete.Yes;
e.Layout.Bands[0].AllowUpdate = AllowUpdate.Yes;
Once you set these properties, you then decide which events to handle; batch events or regular. The combination of the properties that allow the grid to update, add, or delete along with the specific events handled will determine its behavior.
I like NA package. And I appreciate woking code samples.
Please post simple, working, one grid only, web-site with Northwind and ObjectDataSource. Then we can just unzip it, change connection string, run it.
Here is a knowledge base article detailing how to use the WebGrid with an object data source. It contains two sample projects; one in Vb and one in C#:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=9968
Let me know if you have any other questions.
The object data source does delete rows on the client with the following java script which is found in Default.aspx:
function DeleteRow() { var row = igtbl_getActiveRow("UltraWebGrid1"); if (row != null) row.remove(); else alert("Please select a row");
}
That is all that is needed to remove a row on the client. You just need a reference to a row object and then you call the remove method on it. That will remove it from the grids rows collection on the client so when a postback is performed, DeleteRow or DeleteRowBatch will fire. To add a row on the client, you can use this syntax:
This will add a new row to the end of the grids rows collection. For batch updates, you can follow these knowledge base articles:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=8270http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=8272
I saw that one. It doesn't have: client side javascript for add new and delete, server side batch for save new/delete/update.
My suggestion is: in addition to explaining like this thread, please provide working code samples.