This is a migrated thread and some comments may be shown as answers.

Radcomboboxes not updating on aspx page

5 Answers 162 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Amy
Top achievements
Rank 1
Amy asked on 11 Nov 2014, 05:34 PM
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!

5 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 14 Nov 2014, 11:52 AM
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.

 
0
Amy
Top achievements
Rank 1
answered on 18 Nov 2014, 05:31 PM
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?
0
Amy
Top achievements
Rank 1
answered on 20 Nov 2014, 02:52 PM
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!
0
Boyan Dimitrov
Telerik team
answered on 21 Nov 2014, 02:24 PM
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.

 
0
Amy
Top achievements
Rank 1
answered on 24 Nov 2014, 02:18 PM
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!
Tags
ComboBox
Asked by
Amy
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Amy
Top achievements
Rank 1
Share this question
or