Got html from WebServices.
With these additional settings to chart control:
Having problem getting chart html from WebService. My task it to have it on client side from WS.
Failed with both of implementations below:
1.
Having "Object reference not set to an instance of an object." on call
With these additional settings to chart control:
chert.UseSession =
false;
chert.TempImagesFolder =
"~/TempImages/";
Having problem getting chart html from WebService. My task it to have it on client side from WS.
Failed with both of implementations below:
1.
[WebMethod] public string GetChart() { RadChart chert = new RadChart(); chert.ID = "olapChart"; string result = string.Empty; using (MemoryStream stream = new MemoryStream()) { StreamWriter writer = new StreamWriter(stream); HtmlTextWriter htmlWriter = new HtmlTextWriter(writer); chert.RenderControl(htmlWriter); System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); writer.Flush(); result = encoding.GetString(stream.ToArray()); }Having "Object reference not set to an instance of an object." on call
chert.RenderControl(htmlWriter);
2.
[WebMethod]
public string GetChart()
{
return GetChartRendered(chert);
}
private string GetChartRendered(RadChart chert)
{
string result = string.Empty;
TempRenderer pageHolder = new TempRenderer();
HtmlForm tempForm = new HtmlForm();
tempForm.ID = "TempForm";
pageHolder.Controls.Add(tempForm);
tempForm.Controls.Add(new ScriptManager());
tempForm.Controls.Add(chert);
StringWriter output = new StringWriter();
HttpContext.Current.Server.Execute(pageHolder, output, false);
result = output.ToString();
return result;
}
public partial class TempRenderer : System.Web.UI.Page
{
}
Having "Error executing child request for handler 'ChartTest.TempRenderer'" there on Server.Execute.
3. Eventually created just page "chart.aspx" wiht just single chart control decalred
<
telerik:RadChart ID="chert" runat="server" Width="500px" Height="290px" EnableViewState="false" SkinsOverrideStyles="false" ></telerik:RadChart>
and trying this in WebMethod:
StringWriter output = new StringWriter();
HttpContext.Current.Server.Execute("chart.aspx", output, false);
string result = output.ToString();
Having ex:" Error executing child request for chart.aspx."
As I understand the reason of all these exceptions is ChartImage.axd
handler.
If somebody can help - please, it's very urgent.
Thank you.