fomur Posted December 22, 2008 Report Share Posted December 22, 2008 Hi, I am trying to implement usercallback method instead of onclick that I have used previously when I was creating charts. I want to implement AJAX feature of ChartFX so I decided to use usercallback as event handler. However, I am getting this error when I want to use it under my master template: "The target 'Chart1' for the callback could not be found or did not implement ICallbackEventHandler" My page is working without any problems whatsoever when it is a standalone page. Is there any special setting or configuration for implementing usercallback when using a master template? Thanks...file:///C:/DOCUME%7E1/fomur/LOCALS%7E1/Temp/moz-screenshot-1.jpg Quote Link to comment Share on other sites More sharing options...
rkw6086 Posted December 22, 2008 Report Share Posted December 22, 2008 When you use a MasterPage, ASP adds on a GUID to the beginning of the Control ID. You don't know what this is in Javascript. So, in your Javascript, replace Chart1 with <% ChartVar.UniqueID %> Where ChartVar is the C# variable name of your chart. *Note this will only work if you're Javascript is in the master page and not in a separate file. If it's in a separate file, you'll need to capture the text and do a string replace on the file to replace the Chart1 with the ChartVar.UniqueID then inject that to your page. I know this is confusing but this is just how ASP keeps all controls unique. Let me know if you're confused and I'll elaborate some more. Quote Link to comment Share on other sites More sharing options...
fomur Posted December 22, 2008 Author Report Share Posted December 22, 2008 Hi rkw6086, Thanks for help. I got the idea and I am trying to implement as of now. However when I used <% ChartVar.UniqueID %> statement after placing my control instead of "ChartVar" it produces error at Javascript level. Then I have implemented another approach as assigning the value to a hidden field in the master page when page loads to get the value using document.getElementById method however this time I am having VS problems as it does not recognize my fields. I think it is a different issue than the original so once I figured it out I think it is going to work. Also I have found out using ClientID is better. I have used my control's ClientID directly inside the javascript to test it and it worked. Therefore I am going to use it once I resolve this VS problem. Thanks your help again it helped a lot. Ferhat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.