Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Multiple checkbox

Multiple checkbox

Scheduled Pinned Locked Moved C#
questioncsharpasp-nethelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sunsher
    wrote on last edited by
    #1

    Hi, I am working on ASP.NET MVC5. I have a two class that has many fields. In a different view, I want to insert two fields from on table and a list of one field from the other class. Table A CentreId AdminId (UserId) CentreName Address Phone Table B UserId FirstName LastName Email Password The view will have fields like below First Name Last Name Email Centres -------List the centres based on the UserId------- Button Save When the save button is clicked, I wish to add the details to another table like below Table C TeacherId AdminId CenterId How can I accomplish this? Please help Thanks

    OriginalGriffO 1 Reply Last reply
    0
    • S sunsher

      Hi, I am working on ASP.NET MVC5. I have a two class that has many fields. In a different view, I want to insert two fields from on table and a list of one field from the other class. Table A CentreId AdminId (UserId) CentreName Address Phone Table B UserId FirstName LastName Email Password The view will have fields like below First Name Last Name Email Centres -------List the centres based on the UserId------- Button Save When the save button is clicked, I wish to add the details to another table like below Table C TeacherId AdminId CenterId How can I accomplish this? Please help Thanks

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      And? What have you tried? Where are you stuck? What help do you need? And where does TeacherId come from?

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      S 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        And? What have you tried? Where are you stuck? What help do you need? And where does TeacherId come from?

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

        S Offline
        S Offline
        sunsher
        wrote on last edited by
        #3

        Teacher is a new table and hence TeacherId. I added code in the Controller as below Public ActionResult Educator() { int curId = (int)Session["UserId"]; var centres = from c in db.Centres where c.AdminId == curId select c; return View(); } And in View, I have @html.Label("First Name") @Html.EditorFor() @html.Label("Last Name") @Html.EditorFor() @html.Label("Email") @Html.EditorFor() Next, I want a collection of Checkboxes from the Centres result. When I click submit, this record goes to the Users table and also the Teachers table. Thanks

        L 1 Reply Last reply
        0
        • S sunsher

          Teacher is a new table and hence TeacherId. I added code in the Controller as below Public ActionResult Educator() { int curId = (int)Session["UserId"]; var centres = from c in db.Centres where c.AdminId == curId select c; return View(); } And in View, I have @html.Label("First Name") @Html.EditorFor() @html.Label("Last Name") @Html.EditorFor() @html.Label("Email") @Html.EditorFor() Next, I want a collection of Checkboxes from the Centres result. When I click submit, this record goes to the Users table and also the Teachers table. Thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          sunsher wrote:

          Next, I want a collection of Checkboxes from the Centres result.

          I'd recommend reviewing the ng-loop directive. Most books will show how to do this in one of the first chapters.

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups