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

RadCombobox in datalist

5 Answers 116 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 11 Jan 2012, 01:40 PM
hi i need help in this case

i have a radcombobox in datalist and i need register this event:

var pane1 = splitter.getPaneById("<%= RadPane2.ClientID %>");
                var combo1 = $find("<%= ddltipoeval.ClientID %>");
                var paneElem1 = pane1.getContentElement();
                if (combo1 != null) { $telerik.addHandler(paneElem1, "scroll", function() { combo1.hideDropDown(); }, false); }

How do I find the radcombobox in this datalist to record the event I need?, Because I can not register as a normal radcombobox generating the error that I send attached

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Jan 2012, 03:06 PM
Hello,

One suggestion is you can access the RadComboBox on OnClientLoad event of RadComboBox and save it in a global variable and use it.

Thanks,
Princy.
0
Juan
Top achievements
Rank 1
answered on 11 Jan 2012, 04:28 PM
Thanks, but only serves for the first item in datalist, i need to serve in all items, here's the code:
<script type="text/javascript">
        var combodls;
        
        function OnClientLoadHandlerddl(sender) {
            combodls = sender;
        }
        
        Sys.Application.add_load(function() {
            var splitter = $find("<%= RadSplitter1.ClientID %>");
            if (splitter != null) {
                var pane1 = splitter.getPaneById("<%= RadPane2.ClientID %>");

                var combo1 = $find("<%= ddltipoeval.ClientID %>");
                var combo2 = $find("<%= ddlseleccionadopor.ClientID %>");
                var combo3 = $find("<%= ddlfiltroareas.ClientID %>");
                var combo4 = $find("<%= ddlfiltrocargos.ClientID %>");

                var paneElem1 = pane1.getContentElement();
                if (combo1 != null) { $telerik.addHandler(paneElem1, "scroll", function() { combo1.hideDropDown(); }, false); }
                if (combo2 != null) { $telerik.addHandler(paneElem1, "scroll", function() { combo2.hideDropDown(); }, false); }
                if (combo3 != null) { $telerik.addHandler(paneElem1, "scroll", function() { combo3.hideDropDown(); }, false); }
                if (combo4 != null) { $telerik.addHandler(paneElem1, "scroll", function() { combo4.hideDropDown(); }, false); }
                if (combodls != null) { $telerik.addHandler(paneElem1, "scroll", function() { combodls.hideDropDown(); }, false); }
            }
        });
</script>
Please help me if something is wrong, Thanks.
0
Ivana
Telerik team
answered on 13 Jan 2012, 04:58 PM
Hello,

I have tested the following scenario and it does work -- the RadComboBox client objects are found as they should:
Sys.Application.add_load(function () {
    var splitter = $find("<%= RadSplitter1.ClientID %>");
    if (splitter != null) {
        var pane1 = splitter.getPaneById("<%= RadPane2.ClientID %>");
 
        var combo1 = $find("<%= RadComboBox1.ClientID %>");
        var combo2 = $find("<%= RadComboBox2.ClientID %>");
        var combo3 = $find("<%= RadComboBox3.ClientID %>");
    }
});
<telerik:RadSplitter runat="server" ID="RadSplitter1" Height="">
    <telerik:RadPane ID="RadPane1" runat="server">
        <telerik:RadComboBox runat="server" ID="RadComboBox1" Width="100px">
            <Items>
                <telerik:RadComboBoxItem Text="item1" />
                <telerik:RadComboBoxItem Text="item2" />
            </Items>
        </telerik:RadComboBox>
    </telerik:RadPane>
    <telerik:RadSplitBar ID="RadSplitBar1" runat="server">
    </telerik:RadSplitBar>
    <telerik:RadPane ID="RadPane2" runat="server">
        <telerik:RadComboBox runat="server" ID="RadComboBox2" Width="100px">
            <Items>
                <telerik:RadComboBoxItem Text="item1" />
                <telerik:RadComboBoxItem Text="item2" />
            </Items>
        </telerik:RadComboBox>
    </telerik:RadPane>
    <telerik:RadSplitBar ID="RadSplitBar2" runat="server">
    </telerik:RadSplitBar>
    <telerik:RadPane ID="RadPane3" runat="server">
        <telerik:RadComboBox runat="server" ID="RadComboBox3" Width="100px">
            <Items>
                <telerik:RadComboBoxItem Text="item1" />
                <telerik:RadComboBoxItem Text="item2" />
            </Items>
        </telerik:RadComboBox>
    </telerik:RadPane>
</telerik:RadSplitter>

Could you paste here the markup definition of the controls on your page and explain a little bit more about the scenario you are trying to achieve?

Kind regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Juan
Top achievements
Rank 1
answered on 13 Jan 2012, 08:33 PM
the scenario that you show me is simple and already implemented, the idea is to implement when the radcombobox is in a datalist:

<asp:DataList ID="dlslectura" runat="server" RepeatColumns="2" RepeatDirection="Horizontal">
       <ItemTemplate>
               <asp:Table ID="Table22" runat="server" CellPadding="0" CellSpacing="0">
                     <asp:TableRow ID="TableRow55" runat="server" VerticalAlign="Middle">
                             <asp:TableCell ID="TableCell108" runat="server" HorizontalAlign="Right" Width="80">
                                    <telerik:RadComboBox ID="ddledicionparticipantes" MaxHeight="200" runat="server" Skin="Office2010Blue" Width="70" OnClientLoad="OnClientLoadHandlerddl"></telerik:RadComboBox>
                             </asp:TableCell>                                                                                                                    
                     </asp:TableRow>
               </asp:Table>
        </ItemTemplate>
</asp:DataList>

this datalist I'm charging for codebihind, with the solution that you give me the javascript
(var combo1 = $find("<%= ddledicionparticipantes.ClientID %>");) don't find the radcombobox so use Princy's solution

the problem is that only the first radcombobox in the datalist register the event
($telerik.addHandler(paneElem1, "scroll", function() { combodls.hideDropDown(); }, false);)


such as this in the second post that i make and i need that all items in the datalist registrer this event, please help me Thanks
0
Ivana
Telerik team
answered on 18 Jan 2012, 05:32 PM
Hi,

To learn how to find the RadComboBox on the client, when it is embedded in another control, you could refer to the following help article (http://www.telerik.com/help/aspnet-ajax/combobox-find-client-side-embedded-another-control.html). You could also refer to the RadComboBox's client API documentation, for more information how to manipulate the client object of the control.

If you are still having troubles, you could open a support ticket where a sample project, illustrating the issues,  can be attached.

Greetings,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
Juan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Juan
Top achievements
Rank 1
Ivana
Telerik team
Share this question
or