Hi,
I have a link button in template column in child grid and on its click I pop up an alert message to ask the user for confirmation to delete that row. If user clicks Yes I want to do a postback on that button to actually delete the row. I am not able to find the ClientID for that link button inside child grid. Can someone please suggest me how to retrieve the client side or any other way to accomplish this.
Thanks,
Megha
Hello Megha,
If you have further questions let me know.
In the following article the recommended approach to display confirm message before deletion is shown - http://community.infragistics.com/blogs/engineering/archive/2010/08/04/confirm-webdatagrid-row-deletion-with-message-box.aspx
The basic concept here is to handle “RowsDeleting” and cancel it if user do not press OK button.
A little bit different approach is used in the following sample - http://samples.infragistics.com/aspnet/Samples/WebHierarchicalDataGrid/EditAndSelection/DeleteParentRow/Default.aspx?cn=hierarchical-data-grid&sid=3d10caf0-e13c-41b2-8ea4-9aaae176dc46
Here grid selection is used to identify what actual row should be deleted on image button press (image button can be replaced with link button or other controls too). You can again display confirm message before row is actually deleted.
To delete the row on child band (or on any band) you can use the following function:
<script type="text/javascript">function DeleteRow() {var grid = $find('<%= Me.WebHierarchicalDataGrid1.ClientID %>');var selection = grid.get_gridView().get_behaviors().get_selection();/* these will be the selected rows accross all grids, this is an array, but since u havesingle selection it should be an array of one row */var selectedRows = selection.get_selectedRowsResolved();for (var i = 0; i < selectedRows.length; i++) {var row = selectedRows[i];var containerGrid = row.get_grid();var gridRows = containerGrid.get_rows();gridRows.remove(row);}}</script>
If you have additional questions let me know.