Click here to Skip to main content
16,019,435 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
How to create section tag through loops in cshtml in MVC ?it is working fine for div

What I have tried:

@{ 
                        for(int num=0;num<5;num++)
                        {
                            <section id="@num">
                                @num
                            </section>
                        }
                    }
Posted
Updated 2-Apr-20 2:06am
Comments
Richard Deeming 2-Apr-20 8:44am    
You seem to have forgotten to explain what the problem is with the code you posted. If it's working for <div>, what makes you think it's not working for <section>?

1 solution

You can use Html Raw if you just want to render it as html

HTML
@Html.Raw("<section class=\"mutedfont\" id=" + Model.Id + ">")
@Html.Raw("</section>")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900