I am working on a project in ASP.NET MVC using C# 3.0.
I am using the Dundas Chart Control for OLAP. As the Dundas control does not directly support MVC it is used on a standard ASP.NET page with a codebehind file. This page is displayed in an iFrame of a normal View returned from a Controller Action.
I have a button in the iFrame which submits a form via Ajax (using jQuery) to a method on the controller. I have also written an extension method for the OlapChart which returns the XML of the current report.
What I am looking for is a way of getting the XML produced by the extension method to the Controller Action which handles the Ajax submit.
I have only developed using ASP.NET MVC so I may be missing something obvious with Code Behind and ASP.NET controls.
Thanks.
I ‘solved’ this by creating an instance of the controller in the code-behind – in this project using a Spring.net IOC objects.xml file and a Spring.net XmlObjectFactory.
For the button I added an HtmlInputButton to the code-behind and set an onclick event handler. This was made asynchronous using the Dundas OlapManager.GetCallbackEventReference() method combined with a new command handler assigned to the OLAP Chart which provides the calls to invoked the controller methods.
In the Page_Load() function:
And the OLAP command handler:
The iFrame was updated with a response using jQuery and the OlapMananger.ExecuteClientScript() method: