Sign in to follow this  
Guest Basundhara Ghosal

dataurl method and update panels

Recommended Posts

I have an exmaple that works when using Literals and return the charts to them to update. Where it goes wrong is when i use the dataurl method.

I am calling the chart to page using: on default.aspx

<%=GetInfrastructureCapacityURL()%> 

Code behind page is:

public string GetInfrastructureCapacityURL()
{
String dataURL = Server.UrlEncode("dataURL_Infrasturcture_Capacity.aspx");
//Create the chart - Pie 3D Chart with dataURL as strDataURL
return FusionCharts.RenderChart("../FusionCharts/Column3D.swf", dataURL, "", "FactorySum", "600", "300", false, false);
}

On the data_URL_Infrasturcture_Capacity.aspx this is the code:

string connString = "Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Inf_Cap.mdf;Integrated Security=True;User Instance=True";
// OLD LINK Data Source=HECND7261TRBSQLEXPRESS;database=TestDatabase; UID=dbtest;PWD=87JamesH
string strSQL = "SELECT TOP 6 Date = CONVERT(varchar(8), Date, 1), Used_Cap " +
"FROM Inf_Cap_Monthly " +
"ORDER BY Date Desc ";
SqlConnection objConnect = new SqlConnection(connString);
objConnect.Open();
SqlCommand objCommand = new SqlCommand(strSQL, objConnect);
SqlDataReader myReader = objCommand.ExecuteReader();
StringBuilder xmlData = new StringBuilder();
//Generate the chart element
xmlData.AppendFormat("<chart caption='Infrastructure Capacity Usage' subCaption='Monthly' xAxisName='Month' yAxisName='Capacity Used' showValues='0' formatNumberScale='0' showBorder='1'logoURL='../images/steelcase-logo.gif' logoPosition='TL' logoAlpha='100' logoScale='100'>");
while (myReader.Read())
{
xmlData.AppendFormat("<set label='" + myReader["Date"].ToString() + "' value='" + myReader["Used_Cap"].ToString() + "' />");
}
myReader.Close();
xmlData.Append("<trendLines><line startValue='900' color='FF0033' displayvalue='Max Capacity' /></trendLines></chart>");
Response.ContentType = "text/xml";
//Just write out the XML data
//NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
Response.Write(xmlData.ToString());
objConnect.Close();
objConnect.Dispose();

What do i need to do to get that to work with a updatepanel, because when ever it updates it loses the chart and just shows, Chart.

Thanks!

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Please try using "RenderChartHTML" in place of 'RenderChart' for the same.

I hope this helps. Smile.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this