Script control ... is not a registered script conrtol

4 posts, 0 answers
  1. Edney
    Edney avatar
    3 posts
    Member since:
    Jan 2011

    Posted 14 Jan 2011 Link to this post

    I am getting the following message in a user control I have created:
    Script control 'rrLocationRationg' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescription().
    Parameter name: scriptControl

    I have the following code working, however if I uncomment the code in RadCBLocations_ItemsRequested I get the above error.  I need to be able to do this as the data pulled back is to large unless there is some type of filtering done.  Any suggestion would be greatley appreciated.

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LocationDDL.ascx.cs" Inherits="Phoenix.UserControls.LocationDDL" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
        <telerik:RadAjaxPanel ID="rapRefNo" runat="server">
        <telerik:RadComboBox ID="RadCBLocations" Runat="server" EmptyMessage="Choose a Location"
             HighlightTemplatedItems="true" EnableLoadOnDemand="true"  DropDownWidth="755px" 
             Height="200px" Width="253px" onitemsrequested="RadCBLocations_ItemsRequested">
             <HeaderTemplate>
                <table style="width: 730px" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 200px;">
                            Name</td>
                        <td style="width: 200px;">
                            Address</td>
                        <td style="width: 150px;">
                            City</td>
                        <td style="width: 30px;">
                            State</td>
                        <td style="width: 150px;">
                            Rating</td>
                    </tr>
                </table>
            </HeaderTemplate>
            <ItemTemplate>
                <table style="width: 730px" cellspacing="0" cellpadding="0">
                    <tr>
                       <td style="width: 200px;">
                            <%# DataBinder.Eval(Container, "Text")%>
                        </td>
                        <td style="width: 200px;">
                            <%# DataBinder.Eval(Container, "Attributes['Address']")%>
                        </td>
                        <td style="width: 150px;">
                            <%# DataBinder.Eval(Container, "Attributes['City']")%>
                        </td>
                        <td style="width: 30px;">
                            <%# DataBinder.Eval(Container, "Attributes['State']")%>
                        </td>
                        <td style="width: 150px;">
                            <telerik:RadRating ID="rrLocationRating" runat="server" ItemCount="5" OnRate="rrLocationRating_Rate" 
                            Value = <%#Convert.ToDouble(DataBinder.Eval(Container, "Attributes['Rating']"))%> 
                            SelectionMode="Continuous" Precision = "Item" Orientation="Horizontal" AutoPostBack="true" 
                            ClientIDMode="Predictable">
                            </telerik:RadRating>
                        </td>
                    </tr>
                </table>
            </ItemTemplate>
         </telerik:RadComboBox>
        </telerik:RadAjaxPanel>

                  
                if (_userId != 0)
                {
                    _searchString = "alab";
                    if (_searchString.Length > 1)
                    {
                        //Fill the Locations list
                        List<Location> currentLocations = PhoenixData.getLocations(_searchString, false, true, false, false, false);
                        //Sort the locations by name
                        currentLocations.Sort(delegate(Location location1, Location location2) { return location2.Name.CompareTo(location1.Name); });
                        //Create the favorites class to retrieve favorite locations
                        FavoritesRetriever myFavorites = new FavoritesRetriever(FavoritesRetriever.favoriteTables.Location, _userId);
                        //get the locations back sorted by rating
                        ratedLocations = myFavorites.RetrieveRatedEntities<Location>(currentLocations);
                        if (!Page.IsPostBack)
                        {
                            string emptyStr = "";
                            //Populate the rated items in the list
                            foreach (Location loc in ratedLocations)
                            {
                                RadComboBoxItem item = new RadComboBoxItem();
                                item.Text = loc.Name;
                                item.Value = loc.Id.ToString();
      
                                if (loc.Address != null)
                                {
                                    item.Attributes.Add("Address", emptyStr + loc.Address.Address1);
                                    item.Attributes.Add("City", emptyStr + loc.Address.City);
                                    item.Attributes.Add("State", emptyStr + loc.Address.State);
                                }
                                item.Attributes.Add("Rating", loc.Rating.ToString());
                                RadCBLocations.Items.Add(item);
      
                                item.DataBind();
                            }
                        }
                    }
                }
                else
                {
                    throw (new MissingFieldException("UserID is required"));
                }
            }
              
            /// <summary>
            /// Method rrStopRating_Rate created on 1/11/2011
            /// </summary>
            /// <remarks>
            /// Saves the changed rating back to the database
            /// </remarks>
      
            protected void rrLocationRating_Rate(object sender, EventArgs e)
            {
                //Gets the stop id by parsing the id of the changed rating to get the index, which is then applied to ratedstops to get the stop id
                int objectid = ratedLocations[int.Parse(((RadRating)sender).Parent.ClientID.Substring(((RadRating)sender).Parent.ClientID.LastIndexOf('i') + 1))].Id;
      
                //Gets the new value of the favorite
                int value = int.Parse(((RadRating)sender).DbValue.ToString());
                PhoenixData.SaveFavorite(2, objectid, _userId, value);
                  
            }
      
      
            /// <summary>
            /// </summary>
            /// <value></value>
            /// <remarks>
            /// The unique id of the user you want the list to retrieve the favorites for.
            /// </remarks>
            public int UserId
            {
                set { _userId = value; }
            }
      
            public string SearchString
            {
                set { _searchString = value; }
            }
             
            protected void RadCBLocations_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
            {
            //    _searchString = e.Text;
            //    if (e.Text.Length > 1)
            //    {
            //        //Fill the Locations list
            //        List<Location> currentLocations = PhoenixData.getLocations(_searchString, false, true, false, false, false);
            //        //Sort the locations by name
            //        currentLocations.Sort(delegate(Location location1, Location location2) { return location2.Name.CompareTo(location1.Name); });
            //        //Create the favorites class to retrieve favorite locations
            //        FavoritesRetriever myFavorites = new FavoritesRetriever(FavoritesRetriever.favoriteTables.Location, _userId);
            //        //get the locations back sorted by rating
            //        ratedLocations = myFavorites.RetrieveRatedEntities<Location>(currentLocations);
            //        //if (!Page.IsPostBack)
            //        //{
            //        string emptyStr = "";
            //        //Populate the rated items in the list
            //        foreach (Location loc in ratedLocations)
            //        {
            //            RadComboBoxItem item = new RadComboBoxItem();
            //            item.Text = loc.Name;
            //            item.Value = loc.Id.ToString();
      
            //            if (loc.Address != null)
            //            {
            //                item.Attributes.Add("Address", emptyStr + loc.Address.Address1);
            //                item.Attributes.Add("City", emptyStr + loc.Address.City);
            //                item.Attributes.Add("State", emptyStr + loc.Address.State);
            //            }
            //            item.Attributes.Add("Rating", loc.Rating.ToString());
            //            RadCBLocations.Items.Add(item);
      
            //            item.DataBind();
            //        }
            //    }
            }
      
         }
    }
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 18 Jan 2011 Link to this post

    Hello Edney,

    When you load the items of the combobox on demand, you actually send an asynchronous request from the client-side to the server, that's why server controls (as RadRating) cannot be added in the template in such cases. You can add the items in the Page_Load event instead.

    Kind regards,
    Yana
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Edney
    Edney avatar
    3 posts
    Member since:
    Jan 2011

    Posted 18 Jan 2011 Link to this post

    Ok, I now have another problem.  For this to work I need the value typed into the RadComboBox by the user but the value of RadCBLocations.Text always returns "";  I can not find a way to access what the user has typed into the combobox.  If I can get this value your solution will work fine for me.

    Thanks
    Edney
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 Jan 2011 Link to this post

    Hi Edney,

    I've just answered to the support ticket regarding this question. Can we continue our communication there? Thanks

    Greetings,
    Yana
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top