I'm using the 11.2 ASP controls in VS2010 using the WebHierarchicalDataGrid control
I'm doing everything on the server side. I have a column with a button that is wired up to a click event. When I click the button I execute some SQL that updates a value in the current row.
How do I get the updated value to show up in the current row?
Seems like I should be able to tell the grid to do a refresh on the current row.
Thanks.
Brian.
Georgi,
I read the batch update info, I'm not seeing how batch updating will help. I want to update the grid via some code and not via having the user type in something. I'm not seeing a way to change the value in a cell via code after the button click, is there a way?
Let me tell you more about my problem...
In the second band of a WebHierarchicalDataGrid I have a column with a button, when I click the button I want to do a calculation and change the value in another column of the same row with the result of my calculation, and then I want the changed value to show up in the grid and the database.
I get the impression that the best way to do this is to programmatically change the value on the client side via some javascript, correct?
This would allow the grid and database to both reflect the change??
Is this the best approach for my situation?
Is there another way to solve this problem?
So, if this is correct....
I've wired up a button click event and I can get the gridView on the client side using javascript.
However, now I can't get the cell or row I just clicked on. The .get_ActiveCell() is always null.
How can I get the cell / row I just clicked the button in?
Thanks,
Hello Brian,
Here is a sample with WHDG batch updating. You can review it and let me know if this approach works for you in this case:
http://samples.infragistics.com/aspnet/Samples/WebHierarchicalDataGrid/EditAndSelection/BatchUpdating/Default.aspx?cn=hierarchical-data-grid&sid=29a3e22c-ccc7-4214-a7bb-006c13c7b0ea
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
I tried your suggestion. After executing the SQL update I call this code in the button click event.
WebHierarchicalDataGrid1.GridView.ClearDataSource();
WebHierarchicalDataGrid1.DataSourceID = "WebHierarchicalDataSource1";
However, this causes the second band I'm on to collapse and the user loses where they were in the hierarchy.
The closest thing I've been able to do is place the WebHierarchicalDataGrid into a UpdatePanel, then after the SQL update I set the text in the row to what I know the SQL update would do. Plus, I disable the button. But, this has some undesired side effects when the grid resorts.
I'm thinking that a better solution would be to programmatically set the values in the row instead of via the SQL update command. Would this be a better solution? If so, how can I set the value for the row in the click event?
Thank you for posting in our community. You need to rebind again the grid. Clear the data source of the GridView assign the updated data source.
I hope this helps.
For any further questions do not hesitate to contact me.