foreach statement (get string values)
- by nhoyti
Can someone please help me out? My code for splitting the strings is working however, i still need to use the splitted string my page. How can i achieve this? Here's my current code
private void SplitStrings()
{
List<string> listvalues = new List<string>();
listvalues = (List<string>)Session["mylist"];
string[] strvalues = listvalues.ToArray();
if (listvalues != null)
{
foreach (string strElement in listvalues)
{
string[] prods = strElement.ToString().Split("|".ToCharArray());
string prodName = prods[0].ToString();
Response.Write(prodName);
}
}
}
link text
how can i replace the response.write with any label or literal? when i tried to use a literal on the code it displays one single string not all of the strings that's been splitted.
any ideas?