1 Replies - 867 Views - Last Post: 23 July 2018 - 10:48 AM Rate Topic: -----

#1 Silamoth   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-June 14

Target for callback could not be found

Posted 20 July 2018 - 09:32 AM

I'm currently trying to add in AJAX Control Toolkit Rating controls in ASP.NET with C# through code. They get added and display properly, but clicking on a rating produces an error in an alert box:

An unhandled exception has occurred:\r\nThe target 'ctl00$MainContent$0' for the callback could not be found or did not implement ICallbackEventHandler.


The important part seems to be this:

The target for the callback could not be found or did not implement ICallbackEventHandler.

Rating controls added through the Design window work perfectly fine, so I'm almost certain there's something I'm missing in the creation of the Rating controls, but I'm not sure what it is. Could someone please guide me in the right direction? Thanks!

Here is the relevant code:


This is the code that adds the Rating control to the Web Form.
AjaxControlToolkit.Rating linkRating = new AjaxControlToolkit.Rating();
                linkRating.CurrentRating = 1;
                linkRating.MaxRating = 10;
                linkRating.StarCssClass = "ratingStar";
                linkRating.WaitingStarCssClass = "savedRatingStar";
                linkRating.FilledStarCssClass = "filledRatingStar";
                linkRating.EmptyStarCssClass = "emptyRatingStar";
                linkRating.ID = id.ToString();              
                
                id++;

                mainPanel.Controls.Add(linkRating);


This is the code that's used to add a Rating control through the Design window, if that helps.
<ajaxToolkit:Rating ID="Rating1" runat="server"
            StarCssClass = "ratingStar" FilledStarCssClass =  "filledRatingStar"
            EmptyStarCssClass = "emptyRatingStar" WaitingStarCssClass = "savedRatingStar">
        </ajaxToolkit:Rating>


For what it's worth, I'm using Visual Studio 2017 with .NET Framework 4.6.1 and the latest version of the AJAX Control Toolkit. Thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Target for callback could not be found

#2 TechnoBear   User is offline

  • Lady A
  • member icon

Reputation: 328
  • View blog
  • Posts: 1,202
  • Joined: 02-November 11

Re: Target for callback could not be found

Posted 23 July 2018 - 10:48 AM

Where are you creating the control? You should be creating controls in Page_Load.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1