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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:17:53+00:00 2026-06-10T10:17:53+00:00

Using EntityFramework, I have created a page with a number of DetailsView and FormView

  • 0

Using EntityFramework, I have created a page with a number of DetailsView and FormView controls to try and capture survey information (100% inserting; no updating or deleting) to be saved to sql server. The tables/entities involved include Survey, Question, Respondent, Response, Answer and a couple of Type lookups. (A Survey has a list of Questions and is completed by a Respondent. The Respondent’s Response has a list of Answers. An Answer answers a Question.) Hopefully that all makes sense.

Rather than have the user click the autogenerated Insert button in each DetailsView or FormView, I would like to provide a single submit button to insert all the new data, which is what I am currently – and unsuccessfully – trying to code. Essentially, i’m looking for a way to invoke the command called by autmatically created Insert button for each *Form.

I figured the way to do this is to loop through the DetailsView and FormView controls, saving (attaching?) the entities as I go along to the ObjectContext, and then calling SaveChanges() to get them all inserted into the db at once. However, I’m having a problem accessing the new entities. I don’t seem to be able to access them through the FormView/DetailsView itself, and I can’t seem to access the BoundFields within the *Views.

I tried to nest FormViews inside FormViews as this infers it is possible, but I get the error Type 'System.Web.UI.WebControls.FormView' does not have a public property named 'FormView'.

I’m about to start looking into solutions involving the ObjectContext and/or EntityDataSources tied to the DetailsViews, but it seems to me that if I’m coming at it from that side, then I might as well use plain TextBoxes and just loop through them creating all the entity stuff in code, rather than letting the databinding features kick in.

Can someone point to how I can run each *Form’s insert button command to save all the newly created entities in each DetailsView/FormView or let me know if I should start looking in another area (eg ObjectContext or EntityDataSource)?

Many thanks
mcalex

  • 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-10T10:17:54+00:00Added an answer on June 10, 2026 at 10:17 am

    I’m an idiot.

    I just needed to call the *Form’s InsertItem method.

    Have no idea why I didn’t realise the first time i read the API.

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

Sidebar

Related Questions

I have created a new application using Entity Framework 4.3 database migrations. The migrations
I am using EntityFramework 4.1. I have the following model: public class User {
Background: We have a project with many modules. We're using EntityFramework 4.2 with FluentAPI
I have created a very simple Entity Framework 4.0 model using VS2010 Professional. Ignore
I have created an OData/WCF service using Visual Studio 2010 on Windows XP SP3
Let me explain my problem: I have four tables created as objects using Entity
I'm using Entity Framework and I have created an interface for lease transactions: public
I have a number of inputs on my page. I would like to save
Using the Entity Framework 4. I have created a Code First database in the
I have created a repository that is returning data from my database using Entity

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.