Hello,
I'm experiencing some issues with the WHDG. I have seen similar post on this issue but none seems to address the problem I'm having. I am using version 2019.1 CLR45. I know this error normally occurs when a parameter is misspelled or missing but that's not the case here. I'm also having difficulties getting the key values from the parent row to assign to the child row for inserting and updating. Code snippets below:
Thank you in advance for any help on this issue.
Markup:
<body> <form id="form1" runat="server"> <ig:WebScriptManager ID="WebScriptManager1" runat="server" EnablePageMethods="True" ValidateRequestMode="Enabled"></ig:WebScriptManager> <igmisc:WebPageStyler ID="WebPageStyler1" runat="server" EnableAppStyling="True" StyleSetName="Default" /> <asp:HiddenField ID="hdnUserName" runat="server" /> <asp:HiddenField ID="hdnFacilityID" runat="server" /> <asp:HiddenField ID="hdnFacilityName" runat="server" /> <asp:SqlDataSource ID="dsFacilityParent" runat="server" ConnectionString="<%$ ConnectionStrings:CHPComplianceDB %>" SelectCommand="usp_get_Facility_License_Parent" SelectCommandType="StoredProcedure"></asp:SqlDataSource> <asp:SqlDataSource ID="dsFaciltyChild" runat="server" ConnectionString="<%$ ConnectionStrings:CHPComplianceDB %>" InsertCommand="usp_ins_tbl_Facility_License" InsertCommandType="StoredProcedure" SelectCommand="usp_get_Facility_License_Child" SelectCommandType="StoredProcedure" UpdateCommand="usp_upd_tbl_Facility_License" UpdateCommandType="StoredProcedure"> <InsertParameters> <asp:Parameter Name="Facility_ID" Type="Int32" /> <asp:Parameter Name="Facility_Name" Type="String" /> <asp:Parameter Name="Facility_License_Type" Type="String" /> <asp:Parameter Name="Entity_Code" Type="String" /> <asp:Parameter Name="Facility_License_Nbr" Type="String" /> <asp:Parameter Name="License_Issue_Date" Type="String"/> <asp:Parameter Name="License_Expire_Date" Type="String" /> <asp:Parameter Name="Owner" Type="String" /> <asp:Parameter Name="Co_Owner" Type="String" /> <asp:Parameter Name="Comment" Type="String" /> <asp:Parameter Name="Inserted_by" Type="String" /> <asp:Parameter Name="Inesert_Time" Type="DateTime" /> <asp:Parameter Name="Updated_by" Type="String" /> <asp:Parameter Name="Update_Time" Type="DateTime" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="Facility_License_ID" Type="Int32" /> <asp:Parameter Name="Facility_ID" Type="Int32" /> <asp:Parameter Name="Facility_Name" Type="String" /> <asp:Parameter Name="Facility_License_Type" Type="String" /> <asp:Parameter Name="Entity_Code" Type="String" /> <asp:Parameter Name="Facility_License_Nbr" Type="String" /> <asp:Parameter Name="License_Issue_Date" Type="String"/> <asp:Parameter Name="License_Expire_Date" Type="String" /> <asp:Parameter Name="Owner" Type="String" /> <asp:Parameter Name="Co_Owner" Type="String" /> <asp:Parameter Name="Comment" Type="String" /> <asp:Parameter Name="Updated_by" Type="String" /> <asp:Parameter Name="Update_Time" Type="DateTime" /> </UpdateParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="dsListLicenseType" runat="server" ConnectionString="<%$ ConnectionStrings:CHPComplianceDB %>" SelectCommand="SELECT Facility_License_Type_ID ,Facility_License_Type_Name FROM dbo.tbl_Faciliy_License_Type ORDER BY Facility_License_Type_ID"></asp:SqlDataSource> <asp:SqlDataSource ID="dsListEntityCode" runat="server" ConnectionString="<%$ ConnectionStrings:CHPComplianceDB %>" SelectCommand="SELECT Licensing_Entity_ID, Entity_Code FROM dbo.tbl_Licensing_Entity ORDER BY Licensing_Entity_ID"></asp:SqlDataSource> <asp:SqlDataSource ID="dsOwverEmployee" runat="server" ConnectionString="<%$ ConnectionStrings:CHPComplianceDB %>" SelectCommand="SELECT DISTINCT Employee_ID = ADS_Person_ID, Employee_Name = Display_Name FROM dbo.tbl_ADS_Person WHERE Is_Active = 1 AND Department_Name <> '' ORDER BY Display_Name"></asp:SqlDataSource> <ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server"> <DataViews> <ig:DataView ID="dsFacilityParent_DefaultView" DataMember="DefaultView" DataSourceID="dsFacilityParent" /> <ig:DataView ID="dsFaciltyChild_DefaultView" DataMember="DefaultView" DataSourceID="dsFaciltyChild" /> </DataViews> <DataRelations> <ig:DataRelation ChildColumns="Facility_ID,Facility_Name" ChildDataViewID="dsFaciltyChild_DefaultView" ParentColumns="Facility_ID,Facility_Name" ParentDataViewID="dsFacilityParent_DefaultView" /> </DataRelations> </ig:WebHierarchicalDataSource> <div class="w3-panel w3-light-grey"> <div class="w3-container w3-teal w3-center w3-margin-bottom w3-margin-top w3-card-4"> <h4><b><i class="fa fa-building"></i> Facility Licensing</b></h4> </div> <div class="w3-container w3-white w3-card-4 w3-round-large w3-margin"> <div class="w3-row-padding w3-center w3-margin"> <div class="w3-col" style="width: 20%"> <button id="btnFacility" class="w3-btn w3-teal"><i class="fa fa-building-o"></i> Manage Facilties</button> </div> <div class="w3-col" style="width: 20%"> <button id="btnLicType" class="w3-btn w3-teal"><i class="fa fa-id-card"></i> Manage License Types</button> </div> <div class="w3-rest" style="width: 20%"> <button id="bntEntity" class="w3-btn w3-teal"><i class="fa fa-id-card-o"></i> Manage Entities</button> </div> </div> </div> <div class="w3-container w3-white w3-card-4 w3-round-large w3-margin"> <center class="w3-margin"> <ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" Width="96%" AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="Facility_ID,Facility_Name" DataMember="dsFacilityParent_DefaultView" DataSourceID="WebHierarchicalDataSource1" Key="dsFacilityParent_DefaultView" CssClass="GridHeader GridMinHeight" ItemCssClass="GridHeader" HeaderCaptionCssClass="w3-teal"> <Bands> <ig:Band AutoGenerateColumns="False" DataMember="dsFaciltyChild_DefaultView" Key="dsFaciltyChild_DefaultView" DataKeyFields="Facility_License_ID"> <Columns> <ig:BoundDataField DataFieldName="Facility_License_ID" Hidden="True" Key="Facility_License_ID"> <Header Text="Facility_License_ID"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Facility_ID" Hidden="True" Key="Facility_ID"> <Header Text="Facility_ID"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Facility_Name" Key="Facility_Name" Hidden="True"> <Header Text="Facility_Name"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Facility_License_Type" Key="Facility_License_Type"> <Header Text="License Type"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Entity_Code" Key="Entity_Code"> <Header Text="Licensing Entity"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Facility_License_Nbr" Key="Facility_License_Nbr"> <Header Text="License Nbr"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="License_Issue_Date" Key="License_Issue_Date" DataFormatString="{0:d}"> <Header Text="Issue Date"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="License_Expire_Date" Key="License_Expire_Date" DataFormatString="{0:d}"> <Header Text="Expire Date"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Owner" Key="Owner"> <Header Text="Owner"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Co_Owner" Key="Co_Owner"> <Header Text="Co Owner"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Comment" Key="Comment"> <Header Text="Comments"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Inserted_by" Key="Inserted_by"> <Header Text="Created By"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Inesert_Time" Key="Inesert_Time" DataFormatString="{0:d} {0:t}"> <Header Text="Create Time"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Updated_by" Hidden="True" Key="Updated_by"> <Header Text="Updated_by"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Update_Time" Hidden="True" Key="Update_Time"> <Header Text="Update_Time"> </Header> </ig:BoundDataField> </Columns> <Behaviors> <ig:EditingCore EnableInheritance="True"> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="Facility_License_Type" EditorID="WebHierarchicalDataGrid1_DropDownProvider1" /> <ig:EditingColumnSetting ColumnKey="Entity_Code" EditorID="WebHierarchicalDataGrid1_DropDownProvider2" /> <ig:EditingColumnSetting ColumnKey="License_Issue_Date" EditorID="WebHierarchicalDataGrid1_DatePickerProvider1" /> <ig:EditingColumnSetting ColumnKey="License_Expire_Date" EditorID="WebHierarchicalDataGrid1_DatePickerProvider2" /> <ig:EditingColumnSetting ColumnKey="Owner" EditorID="WebHierarchicalDataGrid1_DropDownProvider3" /> <ig:EditingColumnSetting ColumnKey="Co_Owner" EditorID="WebHierarchicalDataGrid1_DropDownProvider4" /> <ig:EditingColumnSetting ColumnKey="Comment" EditorID="WebHierarchicalDataGrid1_TextEditorProvider1" /> <ig:EditingColumnSetting ColumnKey="Inserted_by" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="Inesert_Time" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="Updated_by" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="Update_Time" ReadOnly="True" /> </ColumnSettings> </ig:CellEditing> <ig:RowEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="Facility_License_Type" EditorID="WebHierarchicalDataGrid1_DropDownProvider1" /> <ig:EditingColumnSetting ColumnKey="Entity_Code" EditorID="WebHierarchicalDataGrid1_DropDownProvider2" /> <ig:EditingColumnSetting ColumnKey="License_Issue_Date" EditorID="WebHierarchicalDataGrid1_DatePickerProvider1" /> <ig:EditingColumnSetting ColumnKey="License_Expire_Date" EditorID="WebHierarchicalDataGrid1_DatePickerProvider2" /> <ig:EditingColumnSetting ColumnKey="Owner" EditorID="WebHierarchicalDataGrid1_DropDownProvider3" /> <ig:EditingColumnSetting ColumnKey="Co_Owner" EditorID="WebHierarchicalDataGrid1_DropDownProvider4" /> <ig:EditingColumnSetting ColumnKey="Comment" EditorID="WebHierarchicalDataGrid1_TextEditorProvider1" /> <ig:EditingColumnSetting ColumnKey="Inserted_by" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="Inesert_Time" ReadOnly="True" /> </ColumnSettings> </ig:RowEditing> <ig:RowAdding> <ColumnSettings> <ig:RowAddingColumnSetting ColumnKey="Facility_License_Type" EditorID="WebHierarchicalDataGrid1_DropDownProvider1" /> <ig:RowAddingColumnSetting ColumnKey="Entity_Code" EditorID="WebHierarchicalDataGrid1_DropDownProvider2" /> <ig:RowAddingColumnSetting ColumnKey="License_Issue_Date" EditorID="WebHierarchicalDataGrid1_DatePickerProvider1" /> <ig:RowAddingColumnSetting ColumnKey="License_Expire_Date" EditorID="WebHierarchicalDataGrid1_DatePickerProvider2" /> <ig:RowAddingColumnSetting ColumnKey="Owner" EditorID="WebHierarchicalDataGrid1_DropDownProvider3" /> <ig:RowAddingColumnSetting ColumnKey="Co_Owner" EditorID="WebHierarchicalDataGrid1_DropDownProvider4" /> <ig:RowAddingColumnSetting ColumnKey="Inserted_by" ReadOnly="True" /> <ig:RowAddingColumnSetting ColumnKey="Inesert_Time" ReadOnly="True" /> </ColumnSettings> </ig:RowAdding> </Behaviors> </ig:EditingCore> <ig:RowSelectors> </ig:RowSelectors> </Behaviors> </ig:Band> </Bands> <EditorProviders> <ig:DropDownProvider ID="WebHierarchicalDataGrid1_DropDownProvider1"> <EditorControl ClientIDMode="Predictable" DataSourceID="dsListLicenseType" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" TextField="Facility_License_Type_Name" ValueField="Facility_License_Type_Name" runat="server"> <DropDownItemBinding TextField="Facility_License_Type_Name" ValueField="Facility_License_Type_Name" /> </EditorControl> </ig:DropDownProvider> <ig:DropDownProvider ID="WebHierarchicalDataGrid1_DropDownProvider2"> <EditorControl ClientIDMode="Predictable" DataSourceID="dsListEntityCode" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" TextField="Entity_Code" ValueField="Entity_Code" runat="server"> <DropDownItemBinding TextField="Entity_Code" ValueField="Entity_Code" /> </EditorControl> </ig:DropDownProvider> <ig:DropDownProvider ID="WebHierarchicalDataGrid1_DropDownProvider3"> <EditorControl ClientIDMode="Predictable" DataSourceID="dsOwverEmployee" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" TextField="Employee_Name" ValueField="Employee_Name" runat="server"> <DropDownItemBinding TextField="Employee_Name" ValueField="Employee_Name" /> </EditorControl> </ig:DropDownProvider> <ig:DatePickerProvider ID="WebHierarchicalDataGrid1_DatePickerProvider1"> <EditorControl ClientIDMode="Predictable" runat="server"> </EditorControl> </ig:DatePickerProvider> <ig:TextEditorProvider ID="WebHierarchicalDataGrid1_TextEditorProvider1"> <EditorControl ClientIDMode="Predictable" TextMode="MultiLine" runat="server"> </EditorControl> </ig:TextEditorProvider> <ig:DatePickerProvider ID="WebHierarchicalDataGrid1_DatePickerProvider2"> <EditorControl ClientIDMode="Predictable" runat="server"> </EditorControl> </ig:DatePickerProvider> <ig:DropDownProvider ID="WebHierarchicalDataGrid1_DropDownProvider4"> <EditorControl ClientIDMode="Predictable" DataSourceID="dsOwverEmployee" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" TextField="Employee_Name" ValueField="Employee_Name" runat="server"> <DropDownItemBinding TextField="Employee_Name" ValueField="Employee_Name" /> </EditorControl> </ig:DropDownProvider> </EditorProviders> <Columns> <ig:BoundDataField DataFieldName="Facility_ID" Hidden="True" Key="Facility_ID"> <Header Text="Facility_ID"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Facility_Name" Key="Facility_Name"> <Header Text="Facility"> </Header> </ig:BoundDataField> </Columns> </ig:WebHierarchicalDataGrid> </center> </div> </div> </form> </body>
Code Behind:
Imports System.Data Imports System.Data.SqlClient Imports System.Web.HttpContext Imports Infragistics.Web.UI.GridControls Imports System.Net.Mail Imports Infragistics.Web.UI.WebScriptManager Imports System.Web.Services Imports Infragistics.Web.UI Partial Class _Default Inherits System.Web.UI.Page 'Private struserID As String = Right(Current.User.Identity.Name, Current.User.Identity.Name.Length - 4) Private strFID As String = "" Private strFname As String = "" Private ParentIndex As Integer Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim strUserName As String = "Forrest A. Gump" ''GetUserName(struserID) hdnUserName.Value = strUserName End Sub Private Sub dsFaciltyChild_Inserting(sender As Object, e As SqlDataSourceCommandEventArgs) Handles dsFaciltyChild.Inserting If IsDate(e.Command.Parameters.Item("@License_Issue_Date").Value) Then e.Command.Parameters.Item("@License_Issue_Date").Value = FormatDateTime(e.Command.Parameters.Item("@License_Issue_Date").Value, DateFormat.ShortDate) End If If IsDate(e.Command.Parameters.Item("@License_Expire_Date").Value) Then e.Command.Parameters.Item("@License_Expire_Date").Value = FormatDateTime(e.Command.Parameters.Item("@License_Expire_Date").Value, DateFormat.ShortDate) End If e.Command.Parameters.Item("@Facility_ID").Value = CInt(hdnFacilityID.Value) e.Command.Parameters.Item("@Facility_Name").Value = hdnFacilityName.Value e.Command.Parameters.Item("@Inserted_by").Value = hdnUserName.Value e.Command.Parameters.Item("@Inesert_Time").Value = FormatDateTime(Now, DateFormat.GeneralDate) e.Command.Parameters.Item("@Updated_by").Value = hdnUserName.Value e.Command.Parameters.Item("@Update_Time").Value = FormatDateTime(Now, DateFormat.GeneralDate) End Sub Private Sub dsFaciltyChild_Updating(sender As Object, e As SqlDataSourceCommandEventArgs) Handles dsFaciltyChild.Updating If IsDate(e.Command.Parameters.Item("@License_Issue_Date").Value) Then e.Command.Parameters.Item("@License_Issue_Date").Value = FormatDateTime(e.Command.Parameters.Item("@License_Issue_Date").Value, DateFormat.ShortDate) End If If IsDate(e.Command.Parameters.Item("@License_Expire_Date").Value) Then e.Command.Parameters.Item("@License_Expire_Date").Value = FormatDateTime(e.Command.Parameters.Item("@License_Expire_Date").Value, DateFormat.ShortDate) End If e.Command.Parameters.Item("@Facility_ID").Value = CInt(hdnFacilityID.Value) e.Command.Parameters.Item("@Facility_Name").Value = hdnFacilityName.Value e.Command.Parameters.Item("@Updated_by").Value = hdnUserName.Value e.Command.Parameters.Item("@Update_Time").Value = FormatDateTime(Now, DateFormat.GeneralDate) End Sub Private Sub WebHierarchicalDataGrid1_RowIslandDataBound(sender As Object, e As RowIslandEventArgs) Handles WebHierarchicalDataGrid1.RowIslandDataBound Dim strRwsIsLand As String = e.RowIsland.ID If e.RowIsland.DataMember = "dsFaciltyChild_DefaultView" Then If Not IsNothing(e.RowIsland.ParentRow) Then If Not IsNothing(e.RowIsland.ParentRow.Items(0).Value) Then hdnFacilityID.Value = e.RowIsland.ParentRow.Items(0).Value.ToString ParentIndex = e.RowIsland.ParentRow.Index strFID = hdnFacilityID.Value hdnFacilityName.Value = e.RowIsland.ParentRow.Items(1).Value.ToString strFname = hdnFacilityName.Value End If End If ElseIf e.RowIsland.DataMember = "dsFacilityParent_DefaultView" Then If Not e.RowIsland.Rows Is Nothing Then If Not e.RowIsland.Rows(ParentIndex).Items Is Nothing Then hdnFacilityID.Value = e.RowIsland.Rows(ParentIndex).Items(0).Value hdnFacilityName.Value = e.RowIsland.Rows(ParentIndex).Items(1).Value End If End If End If End Sub Private Sub WebHierarchicalDataGrid1_RowExpanded(sender As Object, e As ContainerRowEventArgs) Handles WebHierarchicalDataGrid1.RowExpanded If e.Row.DataItem.[Type] = "dsFacilityParent_DefaultView" Then ParentIndex = e.Row.Index End If End Sub Public Shared Function GetUserName(ByVal StremployeeID As String) As String If StremployeeID.Length > 0 Then Dim strCnn As String = ConfigurationManager.ConnectionStrings.Item("CHPComplianceDB").ToString Dim strSQL As String = "SELECT Top 1 Display_Name FROM dbo.tbl_ADS_Person WHERE ADS_Person_ID = '" & StremployeeID & "'" Dim strUserName As String = "" Dim m_DBCn As New SqlConnection(strCnn) m_DBCn.Open() Dim drDep As SqlDataReader = GetDataReader(strSQL, 30, m_DBCn) If drDep.HasRows Then strUserName = drDep("Display_Name").ToString drDep.Close() m_DBCn.Close() Return strUserName Else Return "" End If Else Return "" End If End Function Public Shared Function GetDataReader(ByVal SQL As String, ByVal Timeout As Integer, ByVal Cn As SqlConnection, Optional ByVal blnSkipRead As Boolean = False) As SqlDataReader Dim cmdQuery As New SqlCommand Dim dr As SqlDataReader cmdQuery.Connection = Cn cmdQuery.CommandTimeout = Timeout cmdQuery.CommandText = SQL cmdQuery.CommandType = CommandType.Text dr = cmdQuery.ExecuteReader If Not blnSkipRead Then dr.Read() Return dr End Function End Class
Thank you for posting in our community.
I have created and attached a small running sample based on the provided code snippets and I could not reproduce the issue. On my side, the WebHierarchicalDataGrid works as expected.
Please test the sample on your side and let me know how it behaves. If the sample is not working as per your expectation, please modify it so that it replicates the behavior and send it back to me for further investigation.
Looking forward to hearing from you.
8712.Sample.zip
Hello Martin and Happy New Year.
Thank you for your response. I am including the project and DB files where I am have having the issues.