0

I am trying to create divs dynamically in a view page of an asp.net mvc project. This is the pseudo code:

<%
        foreach (element in Model)
        {
           create the html div element with Div.id = Model.id 
        }
    %>

I looked in the system.web.mvc.htmlhelper object. It provides support for a lot of html elements but not a div. Any Hints ?

1 Answer 1

1

There is no such helper for div. But, you can create your own HTML helper for it.

or simply you can go ahead and create divs in view page as

<%
        foreach (element in Model)
        {
           %>
          <div id="<%:element.id%>">
                .. some html..
           </div>     
      <%}
    %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.