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);
}
}
}
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?
Instead of just assigning the value use the concatenation operator to get all the strings. If your label name is label1 then something like
will be enough.