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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:28:11+00:00 2026-05-11T00:28:11+00:00

I am wondering if there is a way to make ASP.NET controls play nicely

  • 0

I am wondering if there is a way to make ASP.NET controls play nicely with my ASP.NET MVC app. Here is what I am doing.

I have an order page which displays info about a single Order object. The page will normally have a bunch of rows of data, each row representing an OrderItem object. Each row is an ASP.NET User Control. On the user control there is a form element with two text boxes (Quantity and Price), and an update button.

When I click the update button, I expect the form to post the data for that individual OrderItem row to a controller method and update the OrderItem record in the database.

Here is my problem: When the post happens, the framework complains because the fields on the form don’t match the parameters on the controller method. Each form field is something like ‘OrderItem_1$Quantity’ or ‘OrderItem_2$Price’ instead of just ‘Quantity’ or ‘Price’ which would match my method parameters.

I have been told that I can overcome this by making sure that the IDs of all my controls are unique for the page, but allow the NAMEs to be repeated between different forms, so that if a form for an individual row is posted, the name can be something that will match what is on my controller method.

The only problem is that I am using ASP.NET controls for my text boxes (which I REALLY want to continue doing) and I can’t find any way to override the name field. There is no Name propery on an ASP.NET control, and even when I try to set it using the Attributes accessor property by saying ‘control.Attributes[‘Name’] = ‘Price’;’ it just adds another name= attribute to the HTML tag which doesn’t work.

Does any one know how I can make this work? I really don’t like all of the HtmlHelper functions like TextBox and DropDown because I hate having my .aspx be so PHP or ASP like with the <%%> tags and everything. Thanks!

  • 1 1 Answer
  • 2 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. 2026-05-11T00:28:12+00:00Added an answer on May 11, 2026 at 12:28 am

    I think you’re straddled between two worlds of ASP.NET WebForms and ASP.NET MVC. You really need to use the Html.TextBox methods, etc. in MVC. This gives you complete control over the markup, which is one of the main benefits of MVC.

    The very problem you’re having with control over the generated HTML, e.g. getting two name attributes, is exactly what MVC is designed to address. If you stop fighting it and go with the flow, it’ll work much better.

    <% %> tags aren’t a problem unless you have logic in there. Putting simple presentation logic on your view is fine.

    If you don’t like this, then maybe it’s better to stick with standard ASP.NET.

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

Sidebar

Related Questions

I am wondering if there is some way to make an box have the
was wondering if there is a way to make superfish using jquery ui theme
I'm wondering if there's any way to make the text of an unordered list
I was wondering if there was a way to make Android games in libgdx
I was wondering, is there a way to make a kind of one to
In an ASP .Net MVC application. I want to make sure my code is
I'm just wondering is there a way to make the 'null' that is outputted
I was wondering if there is any way to make a copy of an
I have some routes in ASP.NET MVC 3. What I want to achieve is
I was wondering: is there a way to make Objective-C support a multi-variable switch

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.