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

  • Home
  • SEARCH
  • 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 7754649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:21:47+00:00 2026-06-01T12:21:47+00:00

i m developing my project in asp.net MVC-3. In these in one module i

  • 0

i m developing my project in asp.net MVC-3.

In these in one module i created a view for creation of team.
In that there is one dropdown list of Project name.
and a listbox(ListBox-1) to display the members of the selected project from dropdownlist.
and there is another listbox(ListBox-2) to transfer/select the selected or all records(member’s names) in it.
which is done perfectly using javascript.

I have to save all the data in database of that form.
in that i have to save the list of team members which are displayed in 2nd listbox(ListBox-2) in the database. And these my question that How to fetch the data of that listbox(ListBox-2) and save it in the database field?

Below is my create team view…
enter image description here

In this form 1st dropdown list displays the project names
And there are two Listbox below the Dropdownlist which are used to display the member names of the project

view code of the listbox is as below..

Dropdownlist for Project
  <%: Html.DropDownListFor(model => model.availableproject, new SelectList(ViewBag.Projects as System.Collections.IEnumerable, "project_id", "project_name"),"Select Project", new { id = "ddlCars" })   %> 


code of listbox.
 <div class="ddlModels" style="float:left; ">
                              <%--  <%: Html.ListBox("projectmembers_id") %>  --%>
                                 <%: Html.ListBoxFor(Models => Models.availableuser, new SelectList(Enumerable.Empty<SelectListItem>(), "user_id", "user_login_name"),
                             new { id = "ddlModels2" }) %>


                            </div>

                            <div style="display:inline; float:left; margin-left:5px; margin-right:5px; margin-top:10px;">
                                <input type="button" name="add" id="alladd"  onclick="CopyListsall();" value=">>" style="width:27px; height:15px; font-size:8px; color:#56a1d6;"/><br />
                                <input type="button" name="add" id="add" onclick="CopyLists();"value=">" style="width:27px; height:15px; font-size:8px; color:#56a1d6;"/><br /><br />
                                <input type="button" name="remove" id="allremove"  onclick="RemoveListsall();" value="<<" style="width:27px; height:15px; font-size:8px; color:#56a1d6;" /><br />                
                                <input type="button" name="remove" id="remove"  onclick="RemoveLists();"  value="<" style="width:27px; height:15px; font-size:8px; color:#56a1d6;" />
                            </div>

                            <div class="ddlModels" style="float:left;">
                             <%: Html.ListBoxFor(Models => Models.availableuser, new SelectList(Enumerable.Empty<SelectListItem>(), "user_id", "user_login_name"),
                             new { id = "ddlModels1" }) %>
                             <%-- <%: Html.ListBox("projectmembers_id") %>--%>
                            </div>

code of the model (.cs file)

namespace ProjectManagementSystem.Models
{
    public class TeamCreate
    {

        [Required(ErrorMessage = "Empty Not Allow")]
        public int team_id { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        [DisplayName("Team Name")]
        public string team_name { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public int project_id { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public string project_name { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public int projectmembers_id { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public int projectmemberuser_id { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public int user_id { get; set; }


        public int SerialNumber { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        [DisplayName("Team Leader")]
        public string user_real_name { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public int technology_skill_id { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public string technology_skill_name { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public string team_description { get; set; }

        [Required(ErrorMessage = "Empty Not Allow")]
        public int leader_id { get; set; }


        public bool t1 { get; set; }

        public List<user_master> availableuser;
        public List<project_master> availableproject;
        public List<team_master> availableteam;
        public List<team_to_user> availableteamuser;

        public List<technology_skill_master> availabletechnology;

        public List<int> SelectSkill { get; set; }
        public List<int> lbtechnologyskillname2 { get; set; }

        public List<int> ddlModels { get; set; }
        public List<int> ddlModels1 { get; set; }

    }
}

2nd .cs file to fetch the data..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ProjectManagementSystem.Models
{
    public class TeamCreateFetch
    {
        private int counter = 1;


        //ProjectManagementSystemEntities3 pb = new ProjectManagementSystemEntities3();
        public static IList<TeamCreate> all()
        {     

            IList<TeamCreate> result =
                (IList<TeamCreate>)HttpContext.Current.Session["team1"];

            if (result == null)
            {
                ProjectManagementSystemEntities3 pb = new ProjectManagementSystemEntities3();

                HttpContext.Current.Session["team1"] = result =

                    ( from l in pb.team_master
                     join u in pb.user_master
                     on l.user_id equals u.user_id
                     select new TeamCreate
                     {
                         //SerialNumber= counter++,
                         team_id= l.team_id,
                         user_id = u.user_id,
                         team_name= l.team_name,
                         user_real_name=u.user_real_name,


            }

            return result;
        }
    }
}

My database is as below…

Table name – team_master

team_id
team_name
user_id(FK with user_id of "user_master")
team_description

Table-2 name- team_to _user

user_id(PK)
user_real_name

Table-3 name- team_to _user

team_id (FK with team id of "team_master")
user_id (FK with user_id of "user_master")

Now i have to save the value of 2nd ListBox in the table “team_to _user” in user_id field.

So how to do that in MVC-3??

thanks in advance

  • 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-01T12:21:49+00:00Added an answer on June 1, 2026 at 12:21 pm

    I suggest doing away with the dual list boxes and implement it as a single MultiSelectListBox.

    The Model

    public class MyClass {
        [Required]
        [Display(Name = "Items Selected (Use ctl + click to select multiple)")]
        public int[] SelectedItems { get; set; }
        public IEnumerable<ItemDTO> Items { get; set; }
    }
    
    public class ItemDTO { 
        public int ID { get; set; }
        public string Name { get; set; }
    }
    

    The View

    @Html.LabelFor(model => model.SelectedItems):                                                     
    @Html.ListBoxFor(model => model.SelectedItems, new MultiSelectList(Model.Items, "ID", "Name", Model.SelectedItems))
    @Html.ValidationMessageFor(model => model.SelectedItems)
    

    In your controller, just loop thru the SelectedItems array and save each

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

Sidebar

Related Questions

everyone. I'm developing a small ASP.NET Mvc project in Mono 2.4, Ubuntu 10.10. There
I'm trying to learn ASP.NET MVC + Entity Framework by developing a small project.
i have a problem i am developing an asp.net mvc project. Website is in
I am developing a medium sized ASP.NET project using ASP.NET MVC and Entity Framework.
I'm in the process of developing an ASP.NET MVC project, and after several weeks
I am developing an ASP.NET MVC project and want to use strongly-typed session objects.
Currently in the early stages of developing a very large project using ASP.Net MVC.
I'm developing a small project in ASP.NET MVC to manage photos, but I don't
I am currently developing an ASP.NET MVC project. I want to implement an ActionFilter,
I'm developing a project using asp.net mvc. And i am saving images to database

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.