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 8514349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:50:32+00:00 2026-06-11T04:50:32+00:00

In my page there is one textbox by default and one add button beside

  • 0

In my page there is one textbox by default and one add button beside it. I need to add the another textbox when user click Add button. And there should be two buttons Add and Remove beside newly added text box. And same process goes on i.e., user can add Textbox using Add button and remove it using remove button.

I am new to mvc 3 so i am confused how to proceed. Is there any way like placeholder in asp.net so that we can add control at runtime.

Any suggestion and idea will be helpful to me

  • 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-11T04:50:34+00:00Added an answer on June 11, 2026 at 4:50 am

    MVC is a very “hands-off” framework compared to Web Forms, so you’re free to add the new textboxes how you like. Note that “controls” don’t exist in MVC.

    Here’s how I’d do it:

    Model:

    class MyModel {
        public Boolean AddNewTextBox { get; set; }
        public List<String> MultipleTextBoxes { get; set; } // this stores the values of the textboxes.
    }
    

    View (I prefer the Web Forms view engine, I’m not a fan of Razor):

    <% for(int i=0;i<Model.MultipleTextBoxes.Count;i++) { %>
    <%= Html.TextBoxFor( m => m.MultipleTextBoxes[i] ) /* this might look like magic to you... */ %>
    <% } %>
    <button type="submit" name="AddNewTextbox" value="true">Add New Textbox</button>
    <button type="submit">Submit form</button>
    

    Controller:

    [HttpPost]
    public ActionResult MyAction(MyModel model) {
        if( model.AddNewTextBox ) model.MultipleTextBoxes.Add("Yet another");
    
        else if( ModelState.IsValid ) {
            // your regular processing
        }
    }
    

    You can also add more textboxes with Javascript and it work perfectly fine. All that matters is the HTML input elements. There’s no cryptic viewstate. MVC is stateless.

    Note that because I used <button type="submit"> my example will not work reliably in Internet Explorer 6-8 (sucks, I know), but you can replace them with <input type="submit"> with no ill-effects.

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

Sidebar

Related Questions

There are two TextBox on the WPF page. While user is typing into the
My usecase is a one-page site. On the page, there should be three frames.
In my html page, I have one table, for every row there are two
In my asp page there is one textbox name ProductName if i write any
I have two search buttons on a page, one linked to a dropdown list
In my form there is a textbox and submit button. When a user starts
My ASP.NET page contains ValidateRequest = true. However, there is one textbox in the
I have a mvc project and on one page there is a table of
I have a page where there is currently more than one form. I used
A 3rd party web application has a cross-scripting security issue. There is one page

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.