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

  • SEARCH
  • Home
  • 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 6332853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:21:30+00:00 2026-05-24T18:21:30+00:00

is there any sort of control for .net mvc 3 (some html helper method

  • 0

is there any sort of control for .net mvc 3 (some html helper method perhaps) that works like an asp:repeater?

I’ve done some googling and only found some home grown solutions.

Here’s what I need:
My users will have a drop down list of numbers, depending what they select (1-8), I need to repeat a set of code below to offer them the same list of input fields (between 1 and 8 times).

what would be the best way to accomplish this with mvc 3 and jquery?

  • 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-05-24T18:21:31+00:00Added an answer on May 24, 2026 at 6:21 pm

    You should use jquery templates for this

    I copy-pasted some code from a project I’m currently working on, but I think you get the picture how you can solve your problem with jquery templates.

    You can put the templates in a partialview. For example:

    <input type="hidden" id="productId" value="${ProductId}"/>
    <div class="formElement">
        <label>@Globalization.Workorders.Domainname</label>
        <input type="text" id="domainname" name="domainname" />        
    </div>
    <div class="formElement">
        <label>@Globalization.Workorders.StartDate</label>
        <input type="text" id="startDate" value=""/>
    </div>
    <input type="submit" id="addHostingProduct" value="@Globalization.Workorders.Add"/>
    <input type="button" id="addHostingProductCancel" value="@Globalization.Workorders.Cancel"/>
    

    The template takes a json object or an array of json objects to render. The ${…} are replaced with values from the json.

    I usually put the partialviews/templates in the view like this:

    <script id="AddHostingProductTemplate" type="text/x-jquery-tmpl">
        @Html.Partial("Templates/AddHostingProduct")
    </script>
    

    When you’re page first loads, you can do something like this, to set the initial values:

    <script type="text/javascript">
        $(document).ready(function() {
            @foreach (var workOrderLine in Model.WorkOrderLines)
            {
                <text>
                      $('#AddHostingProductTemplate').tmpl(@workOrderLine.ToJson()).appendTo("#products")                
                </text>
            }
    
         });
    </script>
    

    The ToJson method is a method I put on the viewmodel, it just serializes the viewmodel into a json string.

    When a user clicks a button or changes the dropdown, it’s easy to use the template in your client side code to render the extra templates. Just use:

    $('#AddHostingProductTemplate').tmpl({ someValue: '1', someOtherValue : ' test' }).appendTo("#products")
    

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with an ASP.NET MVC application. There is a requirement that a
Is there any sort of free control which does what the Occupation field does
For Postgres is there any sort of command line utilities that allow a database
Is there any EASY way to sort an array in descending order like how
Are there any tools to give some sort of histogram of where most of
Is there any standard way of implementing some sort of a write-through buffer for
I'm attempting to create a custom calendar control that inherits from ASP.Net's built in
I am attempting to create a custom server control CollapsablePanel that extends ASP.net's Panel.
Background I'm working on building an ASP.Net MVC 3 application that utilizes: JQueryUI for
Is there a way to iteratively reference an ASP.NET control based on it's name

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.