Sign in to follow this  
Guest Rajroop

Problem parsing xml and querystrings in .NET

Recommended Posts

I have a Fusion Chart I am using on a .aspx page . For some reason I need to add the following line to make it work when the xml gets parsed:

 

xml = xml.Replace("&", "and");

 

Otherwise I get an "Invalid XML Data" Error and my chart does not display. When this line is added chart displays fine.Lack of understanding why this is has come back to bite me now. I now would like to create a drill down where I pass a few querystring values: Ex:

 

xmlOutput.AppendFormat("<set link='OpportunityUnits.aspx?Product=Clevelabs&Rate=A'color='acc4cf' label='{0}'  value='{1}' />", "Clevelabs", dtrQuoteinfo["ClevelabsPotentialRevenue"].ToString());

 

Problem is all of my ampersands are now replaced with the word 'and' which creates the inability to pass multiple querystring values(I actually need the '&' passed to the next page)

Any suggestions would be greatly appreciated.See code below and thanks.

--Jason

SqlCommand selCmdgetQuote;

  SqlDataReader dtrQuoteinfo;

  StringBuilder xmlOutput = new StringBuilder();

 

  //*** chart

  xmlOutput.Append("<chart  caption='Active Quotes Rate B' subCaption='Opportunities in Dollars' showvalues='1' formatNumberScale='3'  yAxisName='Potential Revenue Rate B' decimalPrecision='3' numberPrefix='$'  >");

 

 

  connSomsys2.Close();

  connSomsys2.Open();

  selCmdgetQuote = new SqlCommand("sprocgetPotentialRevenue", connSomsys2);

  selCmdgetQuote.CommandType = CommandType.StoredProcedure;

  selCmdgetQuote.Parameters.Add("@probability_vc", 'A');

  dtrQuoteinfo = selCmdgetQuote.ExecuteReader();

  while (dtrQuoteinfo.Read())

  {

 

 

 

  xmlOutput.AppendFormat("<set color='acc4cf' label='{0}'  value='{1}' />", "Clevelabs", dtrQuoteinfo["ClevelabsPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='e3be4d' label='{0}'  value='{1}' />", "Sleepscout", dtrQuoteinfo["SleepScoutPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='d26447' label='{0}'  value='{1}' />", "SleepView", dtrQuoteinfo["SleepViewPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='3106d2' label='{0}'  value='{1}' />", "Kinetisnse", dtrQuoteinfo["KinetisensePotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='f4ee7b' label='{0}'  value='{1}' />", "Kinesia", dtrQuoteinfo["KinesiaPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='af5656'  label='{0}' value='{1}' />", "Crystal and Dreamport", dtrQuoteinfo["CrystalPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='f7d8b6' label='{0}'  value='{1}' />", "Sapphire and Dreamport", dtrQuoteinfo["SapphirePotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='d28102' label='{0}'  value='{1}' />", "Pressore", dtrQuoteinfo["PressorePotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='ffffff' label='{0}'  value='{1}' />", "WebServices / Repair", dtrQuoteinfo["WebServicesRepairPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='0000FF' label='{0}'  value='{1}' />", "Services/Repair", dtrQuoteinfo["ServiceRepairPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='008000' label='{0}'  value='{1}' />", "BioRadio", dtrQuoteinfo["BioRadioPotentialRevenue"].ToString());

  xmlOutput.AppendFormat("<set color='8B8989' label='{0}'  value='{1}' />", "Sleep Scoring Service", dtrQuoteinfo["SleepScoringServicePotentialRevenue"].ToString());

 

  }

 

 

  dtrQuoteinfo.Close();

  connSomsys2.Close();

 

  xmlOutput.Append("</chart>");

 

  string xml = xmlOutput.ToString();

  xml = xml.Replace("&", "and");

 

  //*** do my chart from xml

  return FusionCharts.RenderChartHTML("../FusionCharts/Column3D.swf", "", xml, "DataOutput", "1300", "350", false);

 

Share this post


Link to post
Share on other sites
Guest Rajroop

Hey,

 

 

 

Welcome to the FusionCharts Forum. :)

 

 

 

Could you please use '%26' in place of '&' and see if it helps?

 

 

 

Please revert to us on any further query.

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