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
165
Cascaded combo box loses value after post
posted

I'm writing  an ASP.NET MVC5 application using Ignite.  I have 3 cascading combo boxes that I need to populate via Ajax calls.  I'll show the first 2 as the third follows the same pattern and has the same issue as the third.  My issue is that after post, the cascaded combo's lose their values.  (The "Parent" works fine)

LMK if you need more details

@Html.LabelFor(model => model.GroupId, "Group")
                    <div>
                        @(Html.Infragistics()
                            .ComboFor(model => model.GroupId)
                            .ID("cmbGroups")
                            .Width("200px")
                            .TextKey("GroupName")
                            .ValueKey("GroupId")
                            .DataSourceUrl(Url.Action("group-combo-data"))
                            .EnableClearButton(false)
                            .DataBind()
                            .Render())
                    </div>

@Html.LabelFor(model => model.ProjectId, "Project")
                    <div>
                        @(Html.Infragistics()
                            .ComboFor(model => model.ProjectId)
                            .ID("cmbProjects")
                            .Width("200px")
                            .TextKey("ProjectName")
                            .ValueKey("ProjectId")
                            .DataBind()
                            .Render())
                    </div>

JavaScript to populate
<script type="text/javascript">
        $(document).delegate("#cmbGroups""igcomboselectionchanged"function (evt, ui) {
 
            var cmbGroups = ui.owner;
            var groupId = cmbGroups.value();
            var postData = { "groupId": groupId };
 
            $.getJSON('@Url.Action("GetProjectsByGroupId""Report")', postData, function (returnData) {
                $("#cmbProjects").igCombo({
                    ID: "cmbProjects",
                    Name: "cmbProjects",
                    dataSourceType: "json",
                    dataSource: returnData,
                    textKey: "ProjectName",
                    valueKey: "ProjectId",
                    enableClearButton: false
                });                
            });
        });
 
    

Parents
  • 2525
    posted

    Hello fuzzbone,

    You can look into our sample here on how to implement cascading dropdown: http://www.igniteui.com/combo/cascading-combos

    Note how in the the sample this behavior is achieved by reassigning a dataSource of the targerted igCombo and then calling the dataBind method. This is also more efficient than reinitializing another igCombo.

Reply Children