<ig:WebHierarchicalDataGrid ID="WebDataGrid1" runat="server" AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="Id" DataMember="dsDivisions_DefaultView" Height="380px" Key="dsDivisions_DefaultView" Width="100%" StyleSetName="LucidDream"> <Columns> <ig:bounddatafield datafieldname="Name" key="Name"><header text="Name"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="Name1" key="Name1"><header text="Name1"></header></ig:bounddatafield> </Columns> <Bands> <ig:band autogeneratecolumns="False" DataKeyFields="Id" ShowHeader="true" datamember="dsAssessments_DefaultView" OnRowsDeleting="RowDeleting" key="dsAssessments_DefaultView"> <Columns> <ig:BoundDataField DataFieldName="Id" Key="Id" Hidden="true"><Header Text="Id"></Header></ig:BoundDataField> <ig:bounddatafield datafieldname="SurveyName" key="SurveyName"><header text="Survey Name"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="EmployeeName" key="EmployeeName"><header text="Employee Name"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="DateCreated" key="DateCreated"><header text="Date Created"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="DateCompleted" key="DateCompleted"><header text="Date Completed"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="Total" key="Total" Width="100px"><header text="Total Completed"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="ClientExternal" key="ClientExternal" Width="100px"><header text="Client External Completed"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="ClientInternal" key="ClientInternal" Width="100px"><header text="Client Internal Completed"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="Team" key="Team" Width="100px"><header text="Team Completed"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="Peer" key="Peer" Width="100px"><header text="Peer Completed"></header></ig:bounddatafield> <ig:bounddatafield datafieldname="Leader" key="Leader" Width="100px"><header text="Leader Completed"></header></ig:bounddatafield> <ig:TemplateDataField Width="50px" Key="Edit" Header-Text="Edit"> <ItemTemplate> <img alt="edit" name="btnEdit" title="Edit Assessment" onclick="ClickEditButton(this.parentElement.parentElement)" ID="btnEdit" src="../../Images/Icons/16/pencil_16.gif" runat="server" /> </ItemTemplate> </ig:TemplateDataField> <ig:TemplateDataField Width="50px" Key="Mail" Header-Text="Mail"> <ItemTemplate> <img alt="email" title="Send emails to Assessees" name="btnMail" onclick="ClickMailButton(this.parentElement.parentElement)" ID="btnMail" src="../../Images/OutlookMail/mail.gif" runat="server" /> </ItemTemplate> </ig:TemplateDataField> <ig:TemplateDataField Width="50px" Key="Delete" Header-Text="Delete"> <ItemTemplate> <img alt="delete" title="Delete Assessment" name="btnDel" ID="btnDel" src="~/Images/ECS/DeleteSmall.gif" runat="server" onclick="DeleteChildRow()" /> </ItemTemplate> </ig:TemplateDataField> </Columns> <Behaviors> <ig:EditingCore AutoCRUD="false" EnableInheritance="true"> <Behaviors> <ig:RowDeleting Enabled="true" /> </Behaviors> </ig:EditingCore> </Behaviors> </ig:band> </Bands> <Behaviors> <ig:VirtualScrolling ScrollingMode="Deferred"></ig:VirtualScrolling> <ig:ColumnResizing></ig:ColumnResizing> <ig:Sorting></ig:Sorting> <ig:Selection CellClickAction="Row" RowSelectType="Single"></ig:Selection> <ig:activation></ig:activation> </Behaviors> </ig:WebHierarchicalDataGrid>
<ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server"> <DataRelations> <ig:DataRelation ChildDataViewID="dsAssessments_DefaultView" ChildColumns="DivisionId" ParentDataViewID="dsDivisions_DefaultView" ParentColumns="Id"></ig:DataRelation> </DataRelations> <DataViews> <ig:dataview id="dsDivisions_DefaultView" datamember="DefaultView" datasourceid="dsDivisions"></ig:dataview> <ig:dataview id="dsAssessments_DefaultView" datamember="DefaultView" datasourceid="dsAssessments"></ig:dataview> </DataViews> </ig:WebHierarchicalDataSource> <asp:SqlDataSource ID="dsAssessments" runat="server" SelectCommandType="StoredProcedure" SelectCommand="[ECS].[GetAssessments]" DeleteCommand="[ECS].[Assessment_Delete]" DeleteCommandType="StoredProcedure" ConnectionString="<%$ ConnectionStrings:cnEvalexI %>"> <DeleteParameters> <asp:Parameter Name="Id" DbType="Int32" /> </DeleteParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="dsDivisions" runat="server" SelectCommandType="StoredProcedure" SelectCommand="[dbo].[Division_GetAllDivisions]" ConnectionString="<%$ ConnectionStrings:cnEvalexI %>"> <SelectParameters> <asp:Parameter Name="CompanyId" Type="Int32" DefaultValue="0" /> </SelectParameters> </asp:SqlDataSource> <script language="javascript" type="text/javascript"> function DeleteChildRow() { var grid = $find('WebDataGrid1'); var gridRows = grid.get_gridView().get_rows(); var selectedRows; var row; var childGrid; for (var j = 0; j < gridRows.get_length(); j++) { row = gridRows.get_row(j); childGrid = row.get_rowIslands()[0]; childGridRows = childGrid.get_rows(); selectedRows = childGrid.get_behaviors().get_selection().get_selectedRows(); if (selectedRows.get_length() > 0) { for (var i = selectedRows.get_length() - 1; i >= 0; i--) { row = selectedRows.getItem(i); childGridRows.remove(row); } // Single Select allowed break; } } } </script>
Hi Silversith,
It has been some time since your post, however in case you still need assistance I would be glad to help.
I have tested your scenario with the code you have provided using version 11.2.20112.1019 but am so far unable to replicate the behavior. In order to research the matter further I would need to know which version of NetAdvantage you are using.
Please feel free to contact me if you have any questions.
Problem was solved a while back, not sure how anymore.
Thank you anyway.
(Silversith/Evalex)
If this code hasn't solved your problem, please let me know and I'll run a comparison between my old code that was posted on here and my new code.
Ensure that AutoCRUD="False"
This is what the child row looks like in the WebDataGrid:
<ig:TemplateDataField Width="35px" Key="Delete" CssClass="FontSmallCenter">
<header text="Delete" CssClass="FontSmallCenter"/>
<ItemTemplate>
<img alt="Delete" title="Delete Assessment" name="btnDel" ID="btnDel" src="~/Images/ECS/DeleteSmall.gif" runat="server" width="16" height="16" onclick="DeleteChildRow()" style="cursor:pointer"/>
</ItemTemplate>
</ig:TemplateDataField>
This script was inserted after the grid:
<script language="javascript" type="text/javascript">
function DeleteChildRow() {
var Result = confirm("Are you sure you want to delete this entry?");
if (Result == true) {
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 have single 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>
This is the server side code:
Public Sub DeleteRow(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowDeletingEventArgs)
If sender.DataMember = "dsAssessments_DefaultView" Then
dsAssessments.DeleteParameters.Item("Id").DefaultValue = e.Row.Items.Item(0).Value
dsAssessments.Delete()
End If
End Sub
If you need more detail or you're having issues, feel free to ask.
Sincerly,
Jaco
Will you share the solution. As I've the same problem.
Thanks,