Hi,
We are facing multiple issues with Manual CRUD for Multilevel Hierarachy. Here is the scenario that we are working on.
1) ContainerGrid objectiveGrid = new ContainerGrid();
e.Row.RowIslands.Add(objectiveGrid);
we are using this mechanism to create the hierarchy of grids. number of child level grids is not fixed. I can grow to 5-10 levels (we have achieved this structure). Finally we have enabled the cell editing for last level of grid. & written update code in
protected
void onRowUpdating(object sender, Infragistics.Web.UI.GridControls.RowUpdatingEventArgs e) event. It works fine data gets updated into datbase. But this event fires the postback event & the child level grid(which is updated) retains it's old value.
How I can show the updated values in the child level grid? Attaching .aspx * .cs file for your reference.
Thanks Rado for your thougts,
Regarding Refreshing the grid I used some other approach which is 50% done. what I did is after my custom ajax call is completed which is used to add data in database I am collapsing the parent grid row. so now when I will expand parent row it will automatically fetch the latest record. below is the code for for collapsing the parent row (it is working as well).
//ajax method to update row in database
default_aspx.addRow(param);grid._parentRow._set_populated(false)grid._parentRow._set_expandedInternal(false);
now when I manually expand the parent row it fetch the latest reconrd. but I could not find the way which will automatically fire the expand event i tried keeping ._set_populated(true) & ._set_expandedInternal(true); but it did not work... is there any way i can expand the row at client side?
nikhilach said: I have kept the RowAdding behaviour true for base WebHierarchicalGrid & EnableInheritance true as well. so it provides a row for adding data at bottom. In pager of the Products grid I have added html 'Add" button as CustomTemplate & on click of this I will add the row in database using ajax call (press Add button without loosing the focus from new row). Now after update I want to reload the grid in which I have added the new row (i.e Product Grid). How I can do that? also how I can prevent events that occurs when focus from new row is changed or enter key is pressed on last column? (this is secondary issue)
I have kept the RowAdding behaviour true for base WebHierarchicalGrid & EnableInheritance true as well. so it provides a row for adding data at bottom. In pager of the Products grid I have added html 'Add" button as CustomTemplate & on click of this I will add the row in database using ajax call (press Add button without loosing the focus from new row). Now after update I want to reload the grid in which I have added the new row (i.e Product Grid). How I can do that?
also how I can prevent events that occurs when focus from new row is changed or enter key is pressed on last column? (this is secondary issue)
I run your sample. So, I see that you make an AJAX call through onClientClick function when "Add button" is pressed and update your DB. According to the current configuration of the grid. The grid is not aware for this call / update, due to the fact that you are using custom API to accomplish this. One way to refresh the grid would be as you clear the rows collection and rebind it but in your case this will not work if you do this in the custom AJAX Call "AddRow()". Maybe you could take the approach when the new row is added and request complete to refresh the updatePanel and provide the new data for the grid. Another approach would be to use the built-in AJAX mechanism of the grid to update your DB. I mean not to use "Add Button" just only Add New row Behavior. Please note that if you use only " Add New row Behavior " the grid will use AJAX to submit the new data to the DB. Another thing that come up in my head now is that you could use RowEdit Template if you want to provide custom GUI for CRUD operations over the gird and keep its AJAX turn on.
So, about your question how to prevent the events in the grid? You are able to cancel them on the client as you subscribe to client - side event with "ing" suffixes.
Hope this helps.
Hello,
Thank you for the sample and detailed information. I'm looking into it. I will update you shortly.
If you are not able to connect to mdf database in app_data folder please use following script to generate tables used in application in your sql server database & modify connection string accordingly.
CREATE TABLE [dbo].[Category]( [CategoryID] [int] NOT NULL, [CategoryName] [nchar](50) NOT NULL)
CREATE TABLE [dbo].[Product]( [CategoryID] [int] NOT NULL, [ProductID] [int] NOT NULL, [ProductName] [nvarchar](50) NOT NULL)
INSERT INTO [dbo].[Category] ([CategoryID] ,[CategoryName]) VALUES (1 ,'A')
INSERT INTO [dbo].[Category] ([CategoryID] ,[CategoryName]) VALUES (2 ,'B')
INSERT INTO [dbo].[Product] ([CategoryID] ,[ProductID] ,[ProductName]) VALUES (1 ,1 ,'P1')
GO
forgot to add foler in kast post :)