none
Populate Uocdropdownlist dynamically RRS feed

  • Question

  • Hello experts,

    I have a requirement to build a custom RCDC UI.

    It should contain two dropdownlists 

    1. Regions

    2. Organizations

    We have fixed number of regions for which I have used XMLDatasource.

    <my:XmlDataSource my:Name="regions">
        <Regions>
          <CountryRegion Code="" Name="" />
          <CountryRegion Code="Reg1" Name="Region1" />
          <CountryRegion Code="Reg2" Name="Region2" />
         </Regions>
      </my:XmlDataSource>

    But We need to populate the organizations based on the selected region.

    I have tried using one more xml reference as shown below:

      <my:XmlDataSource my:Name="Organizations">
      <Organizations>
        <Reg1>
          <Organization Code="" Name="" />
          <Organization Code="Org1" Name="Org1" />
          <Organization Code="Org2" Name="Org2" />
         </Reg1>
    	 <Reg2>
          <Organization Code="" Name="" />
          <Organization Code="Org3" Name="Org3" />
          <Organization Code="Org4" Name="Org4" />
         </Reg2>
      </Organizations>
     </my:XmlDataSource>


    And my UocDropdownList controls are shown below:

    <my:Control my:Name="Region" my:TypeName="UocDropDownList" my:Caption="Region" my:Description="" my:RightsLevel="{Binding Source=rights, Path=Region}" >
                <my:Properties>
                   <my:Property my:Name="Required" my:Value="false" />
                   <my:Property my:Name="ValuePath" my:Value="@Code" />
                  <my:Property my:Name="CaptionPath" my:Value="@Name" />
                  <my:Property my:Name="HintPath" my:Value="@Name" />
                  <my:Property my:Name="ItemSource" my:Value="{Binding Source=regions, Path=/Regions/*}" />
                  <my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=Region, Mode=TwoWay}" />              
                 </my:Properties>
             </my:Control>
             <my:Control my:Name="Organization" my:TypeName="UocDropDownList" my:Caption="Organization" my:Description="" my:RightsLevel="{Binding Source=rights, Path=Organization}" >
                <my:Properties>
                   <my:Property my:Name="Required" my:Value="false" />
                   <my:Property my:Name="ValuePath" my:Value="@Code" />
                  <my:Property my:Name="CaptionPath" my:Value="@Name" />
                  <my:Property my:Name="HintPath" my:Value="@Name" />
                  <my:Property my:Name="ItemSource" my:Value="{Binding Source=Organizations, Path=/Organizations/%Attribute_Region%/*}" />
                  <my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=Organization, Mode=TwoWay}" />                  
                 </my:Properties>
             </my:Control>

    Unfortunately, this approach din't work for me as %Attribute_Region% is not available for the object as this RCDC is used for creation.

    Is there any better approach for achieving this?

    Please advice.


    Thanks and Regards, Siva Kumar Balaguru

    Thursday, October 30, 2014 11:08 AM

All replies