Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Problems binding WHDG to XML datasource
posted

I am trying to bind WHDG bands to and XML datasource following the example on http://help.infragistics.com/NetAdvantage/ASPNET/2010.1/CLR3.5/?page=WebHierarchicalDataGrid_Binding_to_Xml_Data_Source.html

There must be something I am missing, though, because only the parent row is binding.  When I expand a parent row the child row is blank.

Here is the HTML source for the grid:-

    <ig:WebHierarchicalDataGrid ID="uwgJobSearch" runat="server" Height="350px"
        Width="100%" DataKeyFields="GroupCode" DataMember="Groups" Key="Groups" InitialDataBindDepth="-1">

        <GroupingSettings>
            <RemoveButton AltText="Ungroup Column"></RemoveButton>
        </GroupingSettings>

        <CollapseButton AltText="Collapse Row"></CollapseButton>
        <ExpandButton AltText="Expand Row"></ExpandButton>
       
        <Bands>
            <ig:Band DataMember="GroupsGroupItems" Key="GroupItems" >
                <ExpandButton AltText="Expand Row" />
                <CollapseButton AltText="Collapse Row" />
                <GroupingSettings>
                    <RemoveButton AltText="Ungroup Column" />
                </GroupingSettings>
            </ig:Band>
        </Bands>

    </ig:WebHierarchicalDataGrid>

The code behind I use to bind the dataset is:-

                uwgJobSearch.DataSource = dsJobSearch1;
                uwgJobSearch.DataMember = "Groups";
                uwgJobSearch.Bands["GroupItems"].DataMember = "GroupItems";

                this.uwgJobSearch.DataBind();

The XML source for the dataset is:-

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="DSJobSearch" targetNamespace="http://tempuri.org/DSJobSearch.xsd" xmlns:mstns="http://tempuri.org/DSJobSearch.xsd" xmlns="http://tempuri.org/DSJobSearch.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections />
        <Tables />
        <Sources />
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="DSJobSearch" msdata:IsDataSet="true" msdata:Locale="en-US" msprop:Generator_UserDSName="DSJobSearch" msprop:Generator_DataSetName="DSJobSearch">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="GroupItems" msprop:Generator_UserTableName="GroupItems" msprop:Generator_RowDeletedName="GroupItemsRowDeleted" msprop:Generator_RowChangedName="GroupItemsRowChanged" msprop:Generator_RowClassName="GroupItemsRow" msprop:Generator_RowChangingName="GroupItemsRowChanging" msprop:Generator_RowEvArgName="GroupItemsRowChangeEvent" msprop:Generator_RowEvHandlerName="GroupItemsRowChangeEventHandler" msprop:Generator_TableClassName="GroupItemsDataTable" msprop:Generator_TableVarName="tableGroupItems" msprop:Generator_RowDeletingName="GroupItemsRowDeleting" msprop:Generator_TablePropName="GroupItems">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="GroupCode" msprop:Generator_UserColumnName="GroupCode" msprop:Generator_ColumnPropNameInRow="GroupCode" msprop:Generator_ColumnVarNameInTable="columnGroupCode" msprop:Generator_ColumnPropNameInTable="GroupCodeColumn" type="xs:string" />
              <xs:element name="ItemCode" msprop:Generator_UserColumnName="ItemCode" msprop:Generator_ColumnPropNameInRow="ItemCode" msprop:Generator_ColumnVarNameInTable="columnItemCode" msprop:Generator_ColumnPropNameInTable="ItemCodeColumn" type="xs:string" />
              <xs:element name="Description" msprop:Generator_UserColumnName="Description" msprop:Generator_ColumnPropNameInRow="Description" msprop:Generator_ColumnVarNameInTable="columnDescription" msprop:Generator_ColumnPropNameInTable="DescriptionColumn" type="xs:string" />
              <xs:element name="Type" msprop:Generator_UserColumnName="Type" msprop:Generator_ColumnPropNameInRow="Type" msprop:Generator_ColumnVarNameInTable="columnType" msprop:Generator_ColumnPropNameInTable="TypeColumn" type="xs:string" />
              <xs:element name="MatchExpression" msprop:Generator_UserColumnName="MatchExpression" msprop:Generator_ColumnPropNameInRow="MatchExpression" msprop:Generator_ColumnVarNameInTable="columnMatchExpression" msprop:Generator_ColumnPropNameInTable="MatchExpressionColumn" type="xs:string" />
              <xs:element name="ItemValue" msprop:Generator_UserColumnName="ItemValue" msprop:Generator_ColumnPropNameInRow="ItemValue" msprop:Generator_ColumnVarNameInTable="columnItemValue" msprop:Generator_ColumnPropNameInTable="ItemValueColumn" type="xs:string" minOccurs="0" />
              <xs:element name="Operator" msprop:Generator_UserColumnName="Operator" msprop:Generator_ColumnPropNameInRow="Operator" msprop:Generator_ColumnVarNameInTable="columnOperator" msprop:Generator_ColumnPropNameInTable="OperatorColumn" type="xs:string" />
              <xs:element name="DisplayInResult" msprop:Generator_UserColumnName="DisplayInResult" msprop:Generator_ColumnPropNameInRow="DisplayInResult" msprop:Generator_ColumnVarNameInTable="columnDisplayInResult" msprop:Generator_ColumnPropNameInTable="DisplayInResultColumn" type="xs:string" />
              <xs:element name="DisplayWidth" msprop:Generator_UserColumnName="DisplayWidth" msprop:Generator_ColumnPropNameInRow="DisplayWidth" msprop:Generator_ColumnVarNameInTable="columnDisplayWidth" msprop:Generator_ColumnPropNameInTable="DisplayWidthColumn" type="xs:int" minOccurs="0" />
              <xs:element name="ItemFormatType" msprop:Generator_UserColumnName="ItemFormatType" msprop:Generator_ColumnPropNameInRow="ItemFormatType" msprop:Generator_ColumnVarNameInTable="columnItemFormatType" msprop:Generator_ColumnPropNameInTable="ItemFormatTypeColumn" type="xs:string" />
              <xs:element name="AllowCriteriaValueEdit" msprop:Generator_UserColumnName="AllowCriteriaValueEdit" msprop:Generator_ColumnPropNameInRow="AllowCriteriaValueEdit" msprop:Generator_ColumnVarNameInTable="columnAllowCriteriaValueEdit" msprop:Generator_ColumnPropNameInTable="AllowCriteriaValueEditColumn" type="xs:boolean" minOccurs="0" />
              <xs:element name="AllowAdvancedCriteriaEdit" msprop:Generator_UserColumnName="AllowAdvancedCriteriaEdit" msprop:Generator_ColumnVarNameInTable="columnAllowAdvancedCriteriaEdit" msprop:Generator_ColumnPropNameInRow="AllowAdvancedCriteriaEdit" msprop:Generator_ColumnPropNameInTable="AllowAdvancedCriteriaEditColumn" type="xs:boolean" minOccurs="0" />
              <xs:element name="CriteriaIsRequired" msprop:Generator_UserColumnName="CriteriaIsRequired" msprop:Generator_ColumnPropNameInRow="CriteriaIsRequired" msprop:Generator_ColumnVarNameInTable="columnCriteriaIsRequired" msprop:Generator_ColumnPropNameInTable="CriteriaIsRequiredColumn" type="xs:boolean" minOccurs="0" />
              <xs:element name="DisplayOrder" msprop:Generator_UserColumnName="DisplayOrder" msprop:Generator_ColumnPropNameInRow="DisplayOrder" msprop:Generator_ColumnVarNameInTable="columnDisplayOrder" msprop:Generator_ColumnPropNameInTable="DisplayOrderColumn" type="xs:int" minOccurs="0" />
              <xs:element name="ParentList" msprop:Generator_UserColumnName="ParentList" msprop:Generator_ColumnPropNameInRow="ParentList" msprop:Generator_ColumnVarNameInTable="columnParentList" msprop:Generator_ColumnPropNameInTable="ParentListColumn" type="xs:int" minOccurs="0" />
              <xs:element name="ListCode" msprop:Generator_UserColumnName="ListCode" msprop:Generator_ColumnVarNameInTable="columnListCode" msprop:Generator_ColumnPropNameInRow="ListCode" msprop:Generator_ColumnPropNameInTable="ListCodeColumn" type="xs:string" minOccurs="0" />
              <xs:element name="ListItemCode" msprop:Generator_UserColumnName="ListItemCode" msprop:Generator_ColumnVarNameInTable="columnListItemCode" msprop:Generator_ColumnPropNameInRow="ListItemCode" msprop:Generator_ColumnPropNameInTable="ListItemCodeColumn" type="xs:string" minOccurs="0" />
              <xs:element name="DisplayAltValue" msprop:Generator_UserColumnName="DisplayAltValue" msprop:Generator_ColumnVarNameInTable="columnDisplayAltValue" msprop:Generator_ColumnPropNameInRow="DisplayAltValue" msprop:Generator_ColumnPropNameInTable="DisplayAltValueColumn" type="xs:boolean" minOccurs="0" />
              <xs:element name="DisplayFormatExpression" msprop:Generator_UserColumnName="DisplayFormatExpression" msprop:Generator_ColumnPropNameInRow="DisplayFormatExpression" msprop:Generator_ColumnVarNameInTable="columnDisplayFormatExpression" msprop:Generator_ColumnPropNameInTable="DisplayFormatExpressionColumn" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Groups" msprop:Generator_UserTableName="Groups" msprop:Generator_RowDeletedName="GroupsRowDeleted" msprop:Generator_RowChangedName="GroupsRowChanged" msprop:Generator_RowClassName="GroupsRow" msprop:Generator_RowChangingName="GroupsRowChanging" msprop:Generator_RowEvArgName="GroupsRowChangeEvent" msprop:Generator_RowEvHandlerName="GroupsRowChangeEventHandler" msprop:Generator_TableClassName="GroupsDataTable" msprop:Generator_TableVarName="tableGroups" msprop:Generator_RowDeletingName="GroupsRowDeleting" msprop:Generator_TablePropName="Groups">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="GroupCode" msprop:Generator_UserColumnName="GroupCode" msprop:Generator_ColumnPropNameInRow="GroupCode" msprop:Generator_ColumnVarNameInTable="columnGroupCode" msprop:Generator_ColumnPropNameInTable="GroupCodeColumn" type="xs:string" />
              <xs:element name="Description" msprop:Generator_UserColumnName="Description" msprop:Generator_ColumnPropNameInRow="Description" msprop:Generator_ColumnVarNameInTable="columnDescription" msprop:Generator_ColumnPropNameInTable="DescriptionColumn" type="xs:string" />
              <xs:element name="Operator" msprop:Generator_UserColumnName="Operator" msprop:Generator_ColumnPropNameInRow="Operator" msprop:Generator_ColumnVarNameInTable="columnOperator" msprop:Generator_ColumnPropNameInTable="OperatorColumn" type="xs:string" />
              <xs:element name="TemplateCode" msprop:Generator_UserColumnName="TemplateCode" msprop:Generator_ColumnVarNameInTable="columnTemplateCode" msprop:Generator_ColumnPropNameInRow="TemplateCode" msprop:Generator_ColumnPropNameInTable="TemplateCodeColumn" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Template" msprop:Generator_UserTableName="Template" msprop:Generator_RowDeletedName="TemplateRowDeleted" msprop:Generator_RowChangedName="TemplateRowChanged" msprop:Generator_RowClassName="TemplateRow" msprop:Generator_RowChangingName="TemplateRowChanging" msprop:Generator_RowEvArgName="TemplateRowChangeEvent" msprop:Generator_RowEvHandlerName="TemplateRowChangeEventHandler" msprop:Generator_TableClassName="TemplateDataTable" msprop:Generator_TableVarName="tableTemplate" msprop:Generator_RowDeletingName="TemplateRowDeleting" msprop:Generator_TablePropName="Template">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="TemplateCode" msprop:Generator_UserColumnName="TemplateCode" msprop:Generator_ColumnVarNameInTable="columnTemplateCode" msprop:Generator_ColumnPropNameInRow="TemplateCode" msprop:Generator_ColumnPropNameInTable="TemplateCodeColumn" type="xs:string" />
              <xs:element name="TemplateDescription" msprop:Generator_UserColumnName="TemplateDescription" msprop:Generator_ColumnVarNameInTable="columnTemplateDescription" msprop:Generator_ColumnPropNameInRow="TemplateDescription" msprop:Generator_ColumnPropNameInTable="TemplateDescriptionColumn" type="xs:string" minOccurs="0" />
              <xs:element name="ResultStructure" msprop:Generator_UserColumnName="ResultStructure" msprop:Generator_ColumnPropNameInRow="ResultStructure" msprop:Generator_ColumnVarNameInTable="columnResultStructure" msprop:Generator_ColumnPropNameInTable="ResultStructureColumn" type="xs:string" minOccurs="0" />
              <xs:element name="SearchType" msprop:Generator_UserColumnName="SearchType" msprop:Generator_ColumnVarNameInTable="columnSearchType" msprop:Generator_ColumnPropNameInRow="SearchType" msprop:Generator_ColumnPropNameInTable="SearchTypeColumn" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="key1">
      <xs:selector xpath=".//mstns:Groups" />
      <xs:field xpath="mstns:GroupCode" />
    </xs:unique>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:Template" />
      <xs:field xpath="mstns:TemplateCode" />
    </xs:unique>
    <xs:keyref name="GroupsGroupItems" refer="key1" msprop:rel_Generator_UserRelationName="GroupsGroupItems" msprop:rel_Generator_RelationVarName="relationGroupsGroupItems" msprop:rel_Generator_UserChildTable="GroupItems" msprop:rel_Generator_UserParentTable="Groups" msprop:rel_Generator_ParentPropName="GroupsRow" msprop:rel_Generator_ChildPropName="GetGroupItemsRows">
      <xs:selector xpath=".//mstns:GroupItems" />
      <xs:field xpath="mstns:GroupCode" />
    </xs:keyref>
  </xs:element>
</xs:schema>

 

Parents
No Data
Reply
  • 49378
    Suggested Answer
    posted

    Hi smatthews1,

    As far as I can see you are only defining one band in your grid (and that should be your child band). Please note that the columns for the root band for WHDG are defined outside the Bands tag, for instance:

            <ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server"
                Height="350px" Width="400px" >
                <Bands>
                    <ig:Band Key="ChildBand_0">
                    </ig:Band>
                </Bands>
               
                <Columns>
                    <ig:UnboundField Key="Root column">
                        <Header Text="Root column" />
                    </ig:UnboundField>
                </Columns>
            </ig:WebHierarchicalDataGrid>

    Please contact me if you have any questions.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://ko.infragistics.com/support

Children
No Data