---
title: "Split() function isn't giving output"  
description: "Split() function isn't giving output"  
author: "Anonymous User"  
published: 2014-08-21  
updated: 2014-08-21  
canonical: https://www.mindstick.com/forum/2070/split-function-isn-t-giving-output  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Split() function isn't giving output

Whats [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when) in the code..? It isn't working!!

Actually I want to [split](https://www.mindstick.com/blog/11920/top-3-voltas-split-acs-for-your-home) the entries from one of the [field](https://www.mindstick.com/forum/160867/does-mindstick-provide-training-for-field-marketing) of database.. The [items](https://www.mindstick.com/forum/33812/getting-number-of-items-selected-in-uicollectionview-in-ios) in it are separated by commas..

Here is what I am doing.

```
string str = dataSet.Tables[0].Rows[0]["Ingredients"].ToString();string[] split = str.Split(',');IList<string> lblListItemIngredients  = new List<string>();foreach (string item in split){  lblListItemIngredients.Add(item);}and in my aspx page,<ul><li><asp:label id="lblListItemIngredients" runat="server></asp:Label></li></ul>
```

But the [output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular) isn't coming, but in [debugging](https://www.mindstick.com/blog/393/javascript-debugging) [mode](https://yourviews.mindstick.com/view/81372/us-congress-should-go-in-remote-mode-for-proper-functioning), i can see the [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) is splitting.. Whats wrong?

## Replies

### Reply by Sumit Kesarwani

Hi John, try this :

```
<ul>  <asp:Repeater id="lblListItemIngredients" runat="server">   
<ItemTemplate>      <li><%#Container.DataItem %></li>   
</ItemTemplate> 
</asp:Repeater></ul>
```

You don't have to create a list for a data source, an array works just fine:

```
string str =dataSet.Tables[0].Rows[0]["Ingredients"].ToString();string[] split = str.Split(',');lblListItemIngredients.DataSource = split;lblListItemIngredients.DataBind();
```


---

Original Source: https://www.mindstick.com/forum/2070/split-function-isn-t-giving-output

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
