locked
Comma delimited layout RRS feed

  • Question

  • User-34860367 posted

    Hello all,

    I want to display my subject values based on whether or not exist the data. I am not sure how to comma delimited for my specific data layout as follows: 

                        @if (ViewBag.SearchSubjects != null)
                        {
                            <td>
                                @if (item.HasEnglish == true)
                                {
                                    @: ENGLISH,
                                }
                                @if (item.HasMath == true)
                                {
                                    @: MATH,
                                }
                                @if (item.HasScience == true)
                                {
                                    @: SCIENCE,
                                }
                                @if (item.HasSocialStudy == true)
                                {
                                    @: SOCIAL STUDY,
                                }
                            </td>
                        }

    For example: my sample data result can be ENGLISH, MATH, SCIENCE or MATH, SOCIAL STUDY or SCIENCE, MATH, SOCIAL STUDY, ENGLIGH etc.

    I really apreciate your help. Thanks in advance.

    Friday, October 19, 2018 2:03 PM

Answers

  • User-34860367 posted

    I used string builder and trim(), TrimEnd() to concatenate string for resolve comma delimited issue. Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 19, 2018 4:32 PM