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

Cannot add items to RadCombobox inside a RadWindow

1 Answer 73 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 18 Aug 2008, 02:21 AM
Hi

I am using RadAjax 2008 Q2 controls.

In Javascript I am able to successfully get a reference to a RadCombobox in a pop-up dialog.

While I can clear the items, when I try to add a RadComboboxItem I get the following error:

        "htmlfile: Invalid argument."


Below is my Javascript code:

    var contentFrame = gwinEventDetails.GetContentFrame().contentWindow;
    var cboState = contentFrame.$find(contentFrame.gDLGcboVenueStateID);
    var cboStateItem = new Telerik.Web.UI.RadComboBoxItem();
    
    // Clear state combobox
    cboState.clearItems();
    cboStateItem.set_text(SELECT_OPTION);
    cboState.get_items().add(cboStateItem);    --ERROR!!--
    cboStateItem.select();


Hope this is enough information.


Kind regards

Mark Eaton

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosi
Telerik team
answered on 18 Aug 2008, 11:00 AM
Hello Mark,

You can solve the problem by following the steps:

1. Define a method  for adding items to the combo in the content page of RadWindow.

For example:

    function AddNewItem()  
    {  
        
        var combo = $find("RadComboBox1");  
        var comboItem = new Telerik.Web.UI.RadComboBoxItem();  
        comboItem.set_text("aaa");  
        combo.get_items().add(comboItem);  
        comboItem.select();  
          
    }  
 

2
.Call this method from the parent window by the following way:

 gwinEventDetails.GetContentFrame().contentWindow.AddNewItem(); 


Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Mark
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Share this question
or