Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
C#
string longString =
     "Weather Information " +
     "GEO Potentail Height (Gpm) : " + weatherinfo[0] +
     "Pressure (pa) : " + weatherinfo[1] +
     "Sea Tempreature (K) : " + weatherinfo[2] +
     "Significant Height of Wind : " + weatherinfo[3] +
     "waves & swell(m) : " + weatherinfo[3] +
     "Wind Speed(m/s)/Direction(°) : " + str[0] + str[1]  ;
          // str1 = weatherinfo[0] = "-";
           return longString;
>

am trying to return this with break in alert box
Posted
Updated 20-Jan-16 17:45pm
v2
Comments
Member 12119075 20-Jan-16 23:25pm    
RegisterClientScriptBlock(Page, typeof(Page), "client", "alert('" + methodname) + "')", true);
Sergey Alexandrovich Kryukov 20-Jan-16 23:34pm    
Is it ASP.NET and JavaScript alert? Or anything else?
Alert is not good enough for production-level code.
—SA

You can prepare a template to use with String.Format:
private const WeatherDataTemplateString =
      @"Weather Information
      GEO Potentail Height (Gpm) : {0}
      Pressure (pa) : {1}
      Sea Tempreature (K) : {2}
      Significant Height of Wind : {3}
      waves & swell(m) : {4}
      Wind Speed(m/s)/Direction(°) : {5}{6}";
;And, call it like this:
"C#"
textBox1.Text = string.Format(WeatherDataTemplateString, 1, 2, 3, 4, 5, 6, 7);
Just use your 'WeatherInfo and 'str array data to fill out the item list.
 
Share this answer
 
C#
 string report =
"             Weather Information\\n" +
"GEO Potentail Height (Gpm) :" + weatherinfo[0] +
"\\nPressure (pa) : " + weatherinfo[1] +
"\\nSea Tempreature (K) : " + weatherinfo[2] +
"\\nSignificant Height of Wind : " + weatherinfo[3] +
"\\nwaves & swell(m) : " + weatherinfo[3] +
"\\nWind Speed(m/s)/Direction(°) : " + str[0] + "/" + str[1];

      return report;



we can do like this
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 21-Jan-16 0:48am    
Not an answer. Such posts are considered as abuse, better remove it.
—SA
Use the new line character.
string longString =
     "Weather Information " + "\n" +
     "GEO Potentail Height (Gpm) : " + weatherinfo[0] + "\n" +
     "Pressure (pa) : " + weatherinfo[1] + "\n" +
     "Sea Tempreature (K) : " + weatherinfo[2] + "\n" +
     "Significant Height of Wind : " + weatherinfo[3] + "\n" +
     "waves & swell(m) : " + weatherinfo[3] + "\n" +
     "Wind Speed(m/s)/Direction(°) : " + str[0] + str[1]  ;
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 20-Jan-16 23:35pm    
My 5, but I would better wait for confirmation that it should be used for JavaScript alert.
—SA
Member 12119075 20-Jan-16 23:43pm    
I tried like this ,but am not getting an output
Sergey Alexandrovich Kryukov 21-Jan-16 0:48am    
What do you mean "like this", exactly? Please show adequate fragment of code, using "Improve question".
—SA
Abhinav S 21-Jan-16 0:43am    
Yep. It was asp.net. :doh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900