Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8526255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:13:14+00:00 2026-06-11T08:13:14+00:00

Whats wrong in the code..? It isn’t working!! Actually I want to split the

  • 0

Whats wrong in the code..? It isn’t working!!

Actually I want to split the entries from one of the field of database.. The items 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 isn’t coming, but in debugging mode, i can see the string is splitting.. Whats wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:13:15+00:00Added an answer on June 11, 2026 at 8:13 am

    You have to get the data in the list to the control somehow. That doesn’t happen magically just because you give a variable the same name as the id of the control.

    Actually, you should use a different name for the variable, otherwise it will shadow the property that has been added to the page object.

    If you want to make a HTML list it’s not enough to put a label in one list item, that won’t create one list item for each string. You can use a repeater:

    <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();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whats wrong with this code? -(void) drawRect:(CGRect) rect { CGContextRef c = UIGraphicsGetCurrentContext(); if
Can someone please tell me whats wrong with this code. I'm not getting complete
Here is the code I dont know whats wrong with it. <?php //Logout code
Can anyone help me figure out whats wrong with this piece of xaml code?
This is small code. But I couldn't find whats wrong with it. In my
What's wrong with the code of radio button? When I've tried SELECT/OPTION it's working.
what's wrong with my code? i want spinner indicator start when view1.nib start to
Seriously. The simplest jQuery code ever simply isn't working. <script type=text/javascript> $(document).ready(function(){ $('.codeswitcher').click(function() {
I have the following code in my CSS file, which isn't working. #home table
This question isn't really about what's wrong with some code. It's about how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.