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();
// }
// }
}
}
}