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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:03:02+00:00 2026-05-13T02:03:02+00:00

Let’s say I have an edit view that is strongly-typed to a table called

  • 0

Let’s say I have an edit view that is strongly-typed to a table called “MyData”. The view has multiple tabs, each with several different fields from the table. For performance, the data is only loaded when the tab is viewed, so if you only edit a field on tab 1 and submit the form, the data for tab 2 will not be loaded.

The problem I’m running into is on the submit. I’m doing the typical routine of finding the existing record in the database and updating the passed values:

<AcceptVerbs(HttpVerbs.Post)> _
Function Edit(ByVal data As MyData) As ActionResult

    Using dc = New MyDataContext
        Dim orig = dc.MyDatas.Single(Function(x) x.id = data.id)
        orig.name = data.name
        orig.desc = data.desc
        ...
        SubmitChanges()
    End Using

    Return View(orig)

End Function

However, this method doesn’t know which tabs were loaded, so if the tab with “desc” on it is not loaded, this method thinks the user blanked out the “desc” field, and sends NULL to the database.

How can I construct this so that only loaded fields are sent to the database, and unloaded fields are ignored?

  • 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-13T02:03:02+00:00Added an answer on May 13, 2026 at 2:03 am

    Is there any reason you’re not using UpdateModel(orig)?

    If you were using model binding, rather than manually going through the form contents and assigning the values, this would be taken care of for you. The default model binding behaviour is to ignore properties that have no corresponding form values.

    You may want to take a look at this post, and the linked article in there, to learn more about model binding.

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

Sidebar

Related Questions

Let's say I have multiple requirements for a password. The first is that the
Let's say I have a Cat that has two properties: FavoriteKitten SecondFavoriteKitten These kittens
Let's say I have the following text: (example) <table> <tr> <td> <span>col1</span> </td> <td>col2</td>
Let's say that I have a date in R and it's formatted as follows.
Let's say that I have a model that handles recipes, and I want to
Let's say i have a mysql database table 'article' with the following fields: id
Let's say I have table with column 'URL' whrere I store urls like this
Let's say that I have a set of relations that looks like this: relations
Let's say I have two assemblies: BusinessLogic and Web. BusinessLogic has an application setting
Let's say you have a class called Customer, which contains the following fields: UserName

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.