Use Visifire Silverlight Control on an UpdatePanel

Visifire have some nice open source chart controls for Silverlight:

http://www.visifire.com/

They are easy to set up and run, but very difficult to manipulate since all the code used to set it up is in a javascript file (and I don’t have time to work it all out)

All I wanted it to do was put the control on an UpdatePanel, and refresh its datasource on a Client CallBack.

Luckially one guy called Reyza ( and according to google only one) has worked this out in Indonesian:

http://geeks.netindonesia.net/blogs/reyza/archive/2008/05/06/re-execute-javascript-function-in-asp-net-ajax-updatepanel.aspx

( What are the chances? I actually just went to Jakarta  🙂  )

Add the following code DIRECTLY after your UpdatePanel like this:

</asp:UpdatePanel>

<script type =”text/javascript”>

Sys.WebForms.PageRequestManager.getInstance().add_endRequest( endRequest ); 
function endRequest( sender, e )
{ 
var vChart = new Visifire(“Visifire.xap”, 500, 300);
 vChart.setLogLevel(1);
vChart.setDataXml(chartXmlString);
vChart.render( “VisifireChart”);
 }
</script>

 

Basically it just builds it again after an update.

 

 

 

 

Advertisements

3 thoughts on “Use Visifire Silverlight Control on an UpdatePanel

  1. What I want to do is get a reference to the Visifire chart, change the data source and re-render it.

    At the moment it rebuilds the entire control in order to do this, and that is what I meant by ‘hard to manipulate’.

    Any ideas? 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s