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

I cannot have two instances of a UserControl which have an AJAX ComboBox Control on one page?

3 Answers 34 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ahmad Alkhiary
Top achievements
Rank 1
Ahmad Alkhiary asked on 06 Dec 2008, 08:22 PM

Dear Telerik Team,

I have a UserControl which contain an AJAX ComboBox control. When I add two instances of the same UserControl to a page they don't work very well so only one instance of the UserControl work fine.

Why is that happening? How to fix it? I needed to have two instances of the UserControl on my page.

Thank you.

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 08 Dec 2008, 08:37 AM
Hi Ahmad Alkhiary,

What do you mean by "they do not work very well"?

I guess you might experiencing a problem described here:
Using dynamic/unique names for JavaScript functions

Greetings,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ahmad Alkhiary
Top achievements
Rank 1
answered on 10 Dec 2008, 06:10 PM
Yes you are right its the same problem I'm facing.

I tried to make the function name dynamic but it give me a green under line on "<".

This is my function

    function nodeClicking(sender, args)
    {
        var comboBox = $find("<%= RadComboBox1.ClientID %>");
        var node = args.get_node()
      
        document.getElementById('<%=NodeValue.ClientID%>').value = node.get_value();

        comboBox.set_text(node.get_text());      

        comboBox.trackChanges();
        comboBox.get_items().getItem(0).set_value(node.get_text());
        comboBox.commitChanges();

        comboBox.hideDropDown();
    }

the new name I tried to give it but it did not work is
function nodeClicking_<%= ClientID %>(sender, args)

Do I have to remove the following line from my UserControl ASPX file
OnClientNodeClicking="nodeClicking"
and insted of that I write the following line in my code-behind
Page_Load
  Dim oTreeView As RadTreeView = _
  DirectCast(cmbMenuOptions.Items(0).FindControl("RadTreeView"), RadTreeView)
  oTreeView.OnClientNodeClicking = "nodeClicking_" + me.ClientID
End Sub

 

 

0
Atanas Korchev
Telerik team
answered on 10 Dec 2008, 06:55 PM
Hi Ahmad Alkhiary,

The workaround in the KB article should have worked. Please send us a support ticket and attach your project there. We will see what went wrong.

Kind regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Ahmad Alkhiary
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Ahmad Alkhiary
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or