Click here to Skip to main content
15,895,667 members

Create model view to support multiple models with form

Tylrwb asked:

Open original thread
I am batting 1000 here with my questions. So i will try to be as descriptive as possible.

I have multiple views in a layout that come from different models. When a record is selected from a list it opens this layout. At the top of the layout it displays the record information in a table format. This is a simple ID - /AuditSchedule/1122. This is currently the Body. This works.

In another area of the layout i have a list of action links (side menu) that are generated from a another table. The links, I think should be as follows but not sure /AuditSchedule/1122/1. This was accomplished by using the Global.asax with routes.

Naturally when you open this layout you should get all the above plus the first record of the next area of the layout which is the form. In this form i need it to show a question from a table of questions and have a set of check boxes created with, what i will call scores, to the right of the question. These scores are also in a table called scores. Everything that i have in this is pretty much in a data table so that everything can be edited and changed if needed.

When a user submits the form it will store in another table called MainAnswers the id's of the auditSchedule, mainQuestion, and a string of the score. This table is a blank table so it would insert a new record for every Main Question for that AuditSchedule.

So far i have had no luck with help on this. If anyone could point me to an example of this that they have seen. It would be great. I cannot be the only one that has tried to do this. However i am new to MVC C#. If this were Zend and PHP i would have no issues.

I have used the code first approach. All of my relationships are done. The issue lies in implementing the view and saving the information in the right tables.

Anyone that can help would be much appreciated. I am struggling here.

I will show whatever code is needed. Just ask!
Tags: C#, Entity Framework, MVC3

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900