Jump to content
Software FX Community

Creating charts at run time using a placeHolder control.


Recommended Posts

I have a web page with a placeHolder control on it.  I create the chart, add it to the placeholder and the graph is displayed properly.  Howvever, when I try to right click and select a menu item, I get an IE error that states: "The target 'Chart1' for the callback could not be found or did not implement ICallbackEventHandler."

I used the following code to create the chart:

Chart Chart1 = new Chart();Chart1.ID = "Chart1";Chart1.UserCommand += new CommandUIEventHandler(UserChartCmd);PlaceHolder1.Controls.Add(Chart1);   |   |

protected void UserChartCmd(object sender, CommandUIEventArgs e){....}

 What did I miss?


Link to comment
Share on other sites

Where are you doing this code?

If I do it in CreateChildControls it works fine. Maybe you are doing it too late (Form Load)?

By the time the viewstate is loaded and the callback call gets to the page the chart needs to be in the control tree.

This is true for any control that generates an event, not just the chart.


Link to comment
Share on other sites

  • 5 months later...

The issue in this post was that he was NOT doing it in CreateChildControls, he was doing it too late.

If you create the chart in CreateChildControls and add it to the controls collection of the page (or parent control) there is nothing special you need to do.

 What kind of problems are you having?

Link to comment
Share on other sites

Hi, Actually I think I am having the problem in testing.

How can I test this using another site in VS2005?


Which methid I should call in the application in order to check whether the chart is creating as needed.

The thing is I need this charts to be loaded in MOSS 2007 as web parts. But before that I need to test whether its' ok using another site.

Can u pls guide me?


Thanks a lot !!!!!!!!!!

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...