Radcomboboxes not updating on aspx page

6 posts, 0 answers
  1. Amy
    Amy avatar
    106 posts
    Member since:
    Aug 2010

    Posted 11 Nov 2014 Link to this post

    I've a bit of a problem with Telerik radcomboboxes not updating properly on an aspx page. Essentially a user picks a choice 'yes' or 'no' from radcombobox 1. If the user chooses 'yes' then radcombobox 2 should show and radcombobox 3 should be hidden; if the user chooses 'no' then radcombobox 3 should show and radcombobox 2 should be hidden.

    The code behind is vb.net. On the aspx page, combo box 1 is ajaxed and supposed to update the other two radcomboboxes. In the code behind in the SelectedIndexChanged sub for radcombobox 1, the 'visible' property of the radcombobox 2 and 3 are swapped depending on the user's choice.The problem is that the radcomboboxes do not appear to be swapping (i.e., updating on the aspx page) unless the page is reloaded, which I'm assuming happens because reloading the page is in essence forcing a postback.

    I don't want to force a postback to fix this issue as I feel like that's a brute force workaround, and I want to understand why the logic isn't working as it should.Here's the actual code below. I used generic names for the radcomboboxes above. 
    <telerik:AjaxSetting AjaxControlID="cboKey">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="cboKey" />
                    <telerik:AjaxUpdatedControl ControlID="cboKey_X2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cboKey_X2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="cboKey_X2" />
    <telerik:AjaxUpdatedControl ControlID="cboKey" />
                </UpdatedControls>
            </telerik:AjaxSetting>


    Here's the code from combo box 1 SelectedIndexChanged sub:
    If Me.cboKey.Visible = True OrElse Me.cboKey_X2.Visible = True Then
    If piX2 <> 0 Then
        Me.cboKey.Visible = False
        Me.cboKey_X2.Visible = True
    ElseIf piX2 = 0 Then
        Me.cboKey_X2.Visible = False
        Me.cboKey.Visible = True
    End If

    Any help understanding why this doesn't work would be greatly appreciated!
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 14 Nov 2014 Link to this post

    Hello,

    As far as I understand you have 3 RadComboBox control on the page and the first RadComboBox should update the other two. In order to achieve this functionality please refer to the code snippet below:
    //Ajax Settings
    <telerik:AjaxSetting AjaxControlID="first RadComboBox ID">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="second RadComboBox ID" />
                    <telerik:AjaxUpdatedControl ControlID="third RadComboBox ID" />
                </UpdatedControls>
            </telerik:AjaxSetting>



    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Amy
    Amy avatar
    106 posts
    Member since:
    Aug 2010

    Posted 18 Nov 2014 in reply to Boyan Dimitrov Link to this post

    I apologize, I forgot to include that bit of code you suggested when I originally posted.  We do have that logic on the page.  I've also tried wrapping the combo boxes in an asp panel and ajaxing the panel.

    The combo boxes are on a user control that is embedded in the main aspx page.  Perhaps there is something interfering?
  5. Amy
    Amy avatar
    106 posts
    Member since:
    Aug 2010

    Posted 20 Nov 2014 in reply to Boyan Dimitrov Link to this post

    Hi,
    I apologize, I do have code like you showed included on the aspx page but forgot to paste that in my original forum post.

    <telerik:AjaxSetting AjaxControlID="cboX2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelMeta" />
                    <telerik:AjaxUpdatedControl ControlID="cboX2" />
                    <telerik:AjaxUpdatedControl ControlID="cboKey" />
                    <telerik:AjaxUpdatedControl ControlID="cboKey_X2" />
                </UpdatedControls>
            </telerik:AjaxSetting>

    I've also tried wrapping everything up in an asp panel, but still get the same results.

    Also, these comboboxes are on a user control that is embedded in an aspx page.

    Thank you!
  6. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 21 Nov 2014 Link to this post

    Hello,

    Please find attached a sample page that implements very similar scenario.

    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Amy
    Amy avatar
    106 posts
    Member since:
    Aug 2010

    Posted 24 Nov 2014 in reply to Boyan Dimitrov Link to this post

    Thank you for the code sample.  There must be something causing interference  on the pages in my project as the logic you provided is the same logic that we were using.  I have updated the project to rebind a single combo box based on the user's selection in the initial combo box, rather than trying to hide/show two combo boxes.  The logic works and the code seems cleaner/easier to maintain.  Thank you again for your time and help!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017