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
25
Dynamically populate a child dropdownlist based on the parent row selected
posted

I am trying to have a child dropdownlist (CategoryId) be dynamically populated based on the parent's selected id (SummaryId).  I can get ALL categoryIds to populate on the grid, but I wish to only show the categoryIds for the current parent row's Summary Id.  Something like below:

Parent Row  SummaryId -->  Cash

   Child DropDownList CategoryId -->  CheckingAccount,SavingsAccount,...

Parent Row SummaryId --> Investments

  Child DropDownList  CategoryId --> TaxableInvestments,RetirementAccounts,EducationAccounts,... 

Please provide a sample.  Thanks.

 

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" 
            AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="Id"
            DataMember="SummaryListDataSource_DefaultView"
            DataSourceID="StatementHierarchicalDataSource" Height="440px"
            Key="SummaryListDataSource_DefaultView" Width="100%"
            EnableTheming="True"
            oninitializerow="WebHierarchicalDataGrid1_InitializeRow"
            onrowislandspopulating="WebHierarchicalDataGrid1_RowIslandsPopulating"  >
            <ExpandCollapseAnimation SlideOpenDirection="Vertical" SlideOpenDuration="300" SlideCloseDirection="Vertical"
                SlideCloseDuration="300" />
            <GroupingSettings>
            <RemoveButton AltText="Ungroup Column"></RemoveButton>
            </GroupingSettings>            
            <Columns>
                <ig:BoundDataField DataFieldName="Id" Key="Id" Hidden="true">
                    <Header Text="Id" />
                </ig:BoundDataField>
                <ig:BoundDataField DataFieldName="SummaryId" Key="SummaryId">
                    <Header Text="SummaryId" />
                </ig:BoundDataField>>
            </Columns>
            <EmptyRowsTemplate>
                <asp:Label ID="SummaryEmptyLabel" runat="server" Text="No entries...click on the above row to add new items"></asp:Label>           
            </EmptyRowsTemplate>
            <CollapseButton AltText="Collapse Row"></CollapseButton>
            <ExpandButton AltText="Expand Row"></ExpandButton>
            <Bands>
                <ig:Band AutoGenerateColumns="False" DataKeyFields="Id" 
                    DataMember="DetailListDataSource_DefaultView"
                    Key="DetailListDataSource_DefaultView">
                    <ExpandButton AltText="Expand Row" />
                    <CollapseButton AltText="Collapse Row" />
                    <GroupingSettings>
                        <RemoveButton AltText="Ungroup Column" />
                    </GroupingSettings>                                     
                    <Columns>                       
                        <ig:BoundDataField DataFieldName="CategoryId" Key="CategoryId">
                            <Header Text="Category" />
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="Id" Key="Id" Hidden="true">
                            <Header Text="Id" />
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="SummaryId" Key="SummaryId" Hidden="true">
                            <Header Text="SummaryId" />
                        </ig:BoundDataField>
                    </Columns>
                    <Behaviors>
                        <ig:EditingCore EnableInheritance="True" >
                            <Behaviors>
                                <ig:RowAdding Enabled="true" Alignment="Top" EnableInheritance="True" >                        
                                    <ColumnSettings>
                                        <ig:RowAddingColumnSetting ColumnKey="Id"
                                            EditorID="IdTextEditorProvider" />
                                        <ig:RowAddingColumnSetting ColumnKey="SummaryId"
                                            EditorID="SummaryIdDropDownProvider" />
                                        <ig:RowAddingColumnSetting ColumnKey="CategoryId"
                                            EditorID="CategoryIdDropDownProvider" />                   
                                    </ColumnSettings>
                                    <EditModeActions MouseClick="Single"  />
                                </ig:RowAdding>
                                <ig:CellEditing Enabled="true" EnableInheritance="True" >
                                    <ColumnSettings>
                                        <ig:EditingColumnSetting ColumnKey="Id"
                                            EditorID="IdTextEditorProvider" />
                                        <ig:RowAddingColumnSetting ColumnKey="SummaryId"
                                            EditorID="SummaryIdDropDownProvider" />
                                        <ig:EditingColumnSetting ColumnKey="CategoryId"
                                            EditorID="CategoryIdDropDownProvider" />
                                    </ColumnSettings>
                                    <EditModeActions MouseClick="Single"  />
                                </ig:CellEditing>                     
                            </Behaviors>
                        </ig:EditingCore>
                        <ig:Paging></ig:Paging>
                    </Behaviors>
                </ig:Band>
            </Bands>
            <Behaviors>
                <ig:Paging>
                </ig:Paging>
                <ig:Selection ColumnSelectType="Single">
                </ig:Selection>
            </Behaviors>
            <EditorProviders>
                <ig:TextEditorProvider ID="IdTextEditorProvider">
                </ig:TextEditorProvider>
                <ig:DropDownProvider ID="CategoryIdDropDownProvider">
                    <EditorControl ID="CategoryIdDropDownList" runat="server" DropDownContainerMaxHeight="200px" EnableAnimations="False"
                        EnableDropDownAsChild="False">
                        <Button AltText="" />
                    </EditorControl>
                </ig:DropDownProvider> 
            </EditorProviders>
        </ig:WebHierarchicalDataGrid>