Strange ASP .NET Problem!
In the following code:
Response.Write(totalArrayTemp[0] + " - " + totalArrayTemp[1] + " - " + totalArrayTemp[2] + "<br>");//FINE!
shows the values of each variables fine. But , outside of the For Loop, the
Response.Write("TOTAL OWNER " + totalOwner.ToString());
Response.Write("TOTAL IDLE " + totalIdle);
Response.Write("TOTAL CONDOR " + totalCondor.ToString() + "<br>");
Don't show the output. What is even bizarre is that if I comment out the output in the For loop then
Response.Write("TOTAL OWNER " + totalOwner.ToString());
shows fine. And totalIdle and totalCondor never show any output outside of the For loop.
Seems to me like something wrong with using the StringBuilder() coding but how else can I achieve this? Basically, I need to have three variables (string type) to show data as:
totalOwner = "23, 44, 55, 66 77...";
totalIdle = "11, 22, 33, 44, 55....";
totalCondor = "99,88,77, 66, 55....";
Thanks
----------------------------
....
string[] totalArray = totalData.ToString().Split(new char[] { '#' });
system.Text.StringBuilder totalOwner = new System.Text.StringBuilder();
System.Text.StringBuilder totalIdle = new System.Text.StringBuilder();
System.Text.StringBuilder totalCondor = new System.Text.StringBuilder();
for (int i = 0; i < totalArray.Length; i++) {
//let's get the data for TotalOwner
//Response.Write(totalArray[i].ToString() + "<br>");
string[] totalArrayTemp = totalArray[i].ToString().Split(new char[] { ','});
Response.Write(totalArrayTemp[0] + " - " + totalArrayTemp[1] + " - " + totalArrayTemp[2] + "<br>");
totalOwner.Append(totalArrayTemp[0] + ",");//total Owner
totalIdle.Append(totalArrayTemp[1] + ",");//total Idle
totalCondor.Append(totalArrayTemp[2] + ",");//total Condor
}
Response.Write("TOTAL OWNER " + totalOwner.ToString());
Response.Write("TOTAL IDLE " + totalIdle);
Response.Write("TOTAL CONDOR " + totalCondor.ToString() + "<br>");
-------------------------------