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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:50:13+00:00 2026-05-30T23:50:13+00:00

Please forgive me as I am just learning MVC3. I have 2 db tables

  • 0

Please forgive me as I am just learning MVC3.

I have 2 db tables one for competitions and one for answers. For each competition there will be 3 answers associated with it.

My Create view is strongly typed to my competition model. What I want to do is add 3 unbound input boxes to that view and retrieve the results in the controller

My controller looks like this

Function Create(competition As Competition) As ActionResult
  If ModelState.IsValid Then
    db.Competitions.AddObject(competition)
    db.SaveChanges()
    Return RedirectToAction("Index")
  End If
  ViewBag.ClientID = New SelectList(db.Clients, "ClientID", "ClientName", competition.ClientID)
  Return View(competition)
End Function

What i would like to do is something like this

Function Create(competition As Competition) As ActionResult
  If ModelState.IsValid Then
    'DIM ANSWERA AS STRING = INPUTA
    'DIM ANSWERB AS STRING = INPUTB
    'DIM ANSWERC AS STRING = INPUTC

    db.Competitions.AddObject(competition)
    db.SaveChanges()
    'SAVE ANSWERS TO ANSWER TABLE

    Return RedirectToAction("Index")
  End If
  ViewBag.ClientID = New SelectList(db.Clients, "ClientID", "ClientName", competition.ClientID)
  Return View(competition)
End Function

Sorry if I have not formatted the question properly. Hopefully you get the gist of what I am trying to do

thanks

I got the above working by now I want to be able to edit competition details in a view

   Function Edit(id As Integer) As ViewResult
        Dim competition As Competition = db.Competitions.Single(Function(c) c.CompetitionID = id)



       ViewBag.ClientID = New SelectList(db.Clients, "ClientID", "ClientName", competition.ClientID)
        Return View(competition)
    End Function

So I scaffold the view which returns my competition details but how do I add 3 input boxes to display the 3 answers associated with that competition?

  • 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-30T23:50:14+00:00Added an answer on May 30, 2026 at 11:50 pm

    Request("NAME") will look for NAME as the name of a form element, cookie, querystring parameter or server variables.

    Dim answerA as String = Request("answerA")
    Dim answerB as String = Request("answerB")
    Dim answerC as String = Request("answerC")
    

    To be safe you should probably specifically target the form element called “answerA” using:

    Dim answerA as String = Request.Form("answerA")
    

    but either of the two examples above will work.

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

Sidebar

Related Questions

Please forgive me if this is an obvious one. I have an unknown amount
I'm just starting with OO php so please forgive my ignorance. Assuming I have
I am just learning this stuff so please forgive if my code or questions
Please forgive my simple question. I have just started to use Matplotlib and I
I have just started to look at .NET 3.5 so please forgive me if
Please forgive the simplicity of this question. The answer will be obvious to many
I am just starting out with Haskell and Yesod so please forgive if I
Please forgive the newb question, but I am not finding answers elsewhere... probably because
Firstly, please forgive me if I have asked this before (i suffer memory problems
I'm not a Rails developer (currently) so please forgive my ignorance on this. One

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.