Saturday, March 24, 2012

Upgrade to Beta 1 = New Rating control error

I installed the latest framework and toolkit.

My project was working fine with a wizard control that contained rating controls. I've taken the rating controls out of the wizard template and put them in their own update panel and still receive the error. It's a very strange behavior. If I make a new page and do everything, the rating control works fine. I'm using the latest control and did all the changes required to use the new Beta. After the install, I keep receiving this error when loading the page:

System.InvalidOperationException was unhandled by user code
Message="The TargetControlID of '_RatingExtender' is not valid. The value cannot be null or empty."
Source="Microsoft.Web.Extensions"
StackTrace:
at Microsoft.Web.UI.ExtenderControl.RegisterWithScriptManager()
at Microsoft.Web.UI.ExtenderControl.OnInit(EventArgs e)
at AjaxControlToolkit.ExtenderControlBase.OnInit(EventArgs e) in C:\Program Files\Microsoft ASP.NET\AjaxControlToolkit\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:line 338
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.ControlCollection.Add(Control child)
at Microsoft.Web.UI.UpdatePanel.SingleChildControlCollection.AddSingleChild(Control child)
at Microsoft.Web.UI.UpdatePanel.AddContentTemplateContainer()
at Microsoft.Web.UI.UpdatePanel.CreateContents(Boolean recreate)
at Microsoft.Web.UI.UpdatePanel.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Thanks

Anyone ? Can you please take a look? I believe others are experiencing something similar with the mentioned TargetControlID.

Thanks


When the project breaks, it breaks at the bold:

/// <summary>
/// On Init we load target properties values and process databinding handlers.
/// </summary>
/// <param name="e"></param>
protected override void OnInit(EventArgs e)
{
if (EnableClientState)
{
CreateClientStateField();
}
// EnsureProfileScriptService(ScriptManager.GetCurrent(Page), true);
Page.PreLoad += new EventHandler(Page_PreLoad);
base.OnInit(e);
}


Please reply with acomplete, self-contained sample page that demonstrates the problem. Thank you!

In my case the problem occures when I specify the rating control in the skin file.

Skinfile:

<

ajaxToolkit:Ratingrunat="server"StarCssClass="ratingStar"WaitingStarCssClass="savedRatingStar"FilledStarCssClass="filledRatingStar"EmptyStarCssClass="emptyRatingStar"/>
Good to know! Do you have a complete, self-contained sample we can play with?

Just add the following 2 lines in the Default.skin file of the Ajax Control Toolkit SampleWebSite:

<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>
<ajaxToolkit:Ratingrunat="server"StarCssClass="ratingStar"WaitingStarCssClass="savedRatingStar"FilledStarCssClass="filledRatingStar"EmptyStarCssClass="emptyRatingStar"/>

Then try to open the Rating sample of the SampleWebSite.


The SampleWebSite doesn't have a Default.skin file - might there be something else going on here that's causing issues?

No comments:

Post a Comment