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

[Solved] LoadOnDemand with Master Pages and WebUserControls

1 Answer 62 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jason Boland
Top achievements
Rank 1
Jason Boland asked on 17 Aug 2009, 05:06 PM
I'm following the Multicolumn Combobox example I downloaded from your site.

I can get the following example to work fine on a stand alone ASPX page.  When I introduce it into my environment which has Master Pages and WebUserControls I can't seem to get it working.

Here is the code.  Only difference when it's moved to Masterpages/WebUserControls environment is that the Script Manager is on the main Master Page.  Any ideas?

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
    <style type="text/css">  
        .column  
        {  
            float: left;  
            text-align: left;  
        }  
    </style>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <asp:ScriptManager ID="smMain" runat="server">  
            <Scripts>  
                <asp:ScriptReference Path="~/js/prototype-1.6.0.2.js" />  
                <asp:ScriptReference Path="~/js/comboClientSide.js" />  
            </Scripts>  
        </asp:ScriptManager>  
 
        <script type="text/javascript">  
            var cb;  
            function cb_onDataBound(pComboboxItem, pDropDownLine) {  
                var customAttributes = pComboboxItem.get_attributes();  
 
                pDropDownLine.update(  
                '<span class="column" style="width:180px;">' + pComboboxItem.get_text() + '</span>'  
                + '<span class="column" style="width:100px;">' + customAttributes.getAttribute("City") + '</span>'  
                + '<span class="column" style="width:100px;">' + customAttributes.getAttribute("Region") + '</span>'  
                + '<span class="column" style="width:100px;">' + customAttributes.getAttribute("SubRegion") + '</span>'  
                + '<span class="column" style="width:100px;">' + customAttributes.getAttribute("Country") + '</span>'  
            );  
            }  
            function pageLoad(sender, args) {  
                initComboExtensions();  
                cb = $find("<%= RadComboBox1.ClientID %>");  
                cb.onDataBound = cb_onDataBound;  
            }  
 
     
        </script>  
 
        <table border="0" width="100%" cellpadding="10px" bgcolor="#84a1c3">  
            <tr>  
                <td>  
                    <font color="black">&nbsp;<b>Information</b></font><br />  
                    <br />  
                    <hr />  
                </td>  
            </tr>  
        </table>  
        <table border="0" width="100%" cellpadding="10px" bgcolor="#84a1c3">  
            <tr>  
                <td>  
                    <br />  
                    <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="300px" Height="200px" 
                        DropDownWidth="950px" EnableLoadOnDemand="true" EnableItemCaching="true" OnClientItemsRequesting="OnClientItemsRequesting" 
                        OnClientItemsRequested="OnClientItemsRequested" OnClientDropDownOpening="OnClientDropDownOpening">  
                        <ExpandAnimation Type="none" />  
                        <CollapseAnimation Type="none" />  
                        <WebServiceSettings Path="~/Inventory/Webservices/wsInventory.asmx" Method="SearchCatalog" />  
                        <HeaderTemplate>  
                            <ul style="list-style: none">  
                                <li><span class="column" style="width: 180px;">Name</span> <span class="column" style="width: 100px;">  
                                    City</span> <span class="column" style="width: 100px;">Region</span> <span class="column" 
                                        style="width: 100px;">SubRegion</span> <span style="width: 100px;">Country</span>  
                                </li>  
                            </ul>  
                        </HeaderTemplate>  
                    </telerik:RadComboBox>  
                </td>  
            </tr>  
        </table>  
    </div>  
    </form>  
</body>  
</html> 

 <WebMethod()> _  
    Public Function SearchCatalog(ByVal context As RadComboBoxContext) As RadComboBoxData  
 
        Dim BLL As New Inventory  
        Dim oDT As DataTable = BLL.SearchCatalog(context.Text)  
 
        Dim comboData As New RadComboBoxData()  
        Dim result As New List(Of RadComboBoxItemData)  
 
        If Not IsNothing(oDT) Then 
            If oDT.Rows.Count > 0 Then 
                For Each oRow As DataRow In oDT.Rows  
                    Dim itemData As New RadComboBoxItemData()  
                    itemData.Text = oRow("Name").ToString()  
                    itemData.Value = oRow("CatalogID").ToString()  
                    itemData.Attributes("City") = oRow("City").ToString()  
                    itemData.Attributes("Region") = oRow("Region").ToString()  
                    itemData.Attributes("SubRegion") = oRow("SubRegion").ToString()  
                    itemData.Attributes("Country") = oRow("Country").ToString()  
                    result.Add(itemData)  
                Next 
            Else 
                Dim itemData As New RadComboBoxItemData()  
                itemData.Text = "No Results..." 
                itemData.Value = "0" 
                itemData.Attributes("City") = "" 
                itemData.Attributes("Region") = "" 
                itemData.Attributes("SubRegion") = "" 
                itemData.Attributes("Country") = "" 
 
                result.Add(itemData)  
            End If 
        End If 
 
        comboData.Items = result.ToArray()  
        Return comboData  
 
    End Function 

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 18 Aug 2009, 09:02 AM
Hi Jason Boland,

What exactly is not working? Do you see any errors on the page? Can you open the dropdown, does it show the Loading message? Are any items added to the dropdown?

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Jason Boland
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or