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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:02:48+00:00 2026-06-01T20:02:48+00:00

I have a ViewData that is being used to generate a List, upon selecting

  • 0

I have a ViewData that is being used to generate a List, upon selecting an item, that items info will be displayed in textboxes for viewing and editing. Upon clicking the save button, it saves but the listbox isn’t being updated, how can update this listbox since I’m using a viewdata?

   @Html.ListBox("ListBoxName", new SelectList((IEnumerable<Epic>)ViewData["selectedestimate"], "Id", "Name", "EstimatedTime"), new {@class = "ListBoxClass", @style = "height: 325px;"})

   <button id="EpicSaveId" type="submit" class="btn" onclick="SaveEpicInfo((document.getElementById('EpicNameID').value), (document.getElementById('EpicTimeId').value), (document.getElementById('EpicDescriptionID').value))">

Upon Clicking Save Button: (Javascript)

        function SaveEpicInfo(name, time, description) {
    $.get('@Url.Action("SaveEditEpic", "Estimate")', { id: eid, epicname: name, epictime: time, epicdescription: description }, function (result) {
        alert(result);

    });

}

Controller:

     [AcceptVerbs(HttpVerbs.Get)]
    public JsonResult SaveEditEpic(int id, string epicname, double epictime, string epicdescription)
    {
        var epic = epicRepository.Select().SingleOrDefault(x => x.Id.Equals(id));
        if (epic != null)
        {
            epic.Name = epicname;
            epic.EstimatedTime = epictime;
            epic.EpicDescription = epicdescription;
            //ViewData["selectedestimate"] = epicRepository.Select().Where(x => x.EstimateId.Equals(ActiveEstimateId)).ToList();
            return Json("Epic Saved", JsonRequestBehavior.AllowGet);
        }
        else
        {
            return Json("Error");
        }
    }
  • 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-01T20:02:48+00:00Added an answer on June 1, 2026 at 8:02 pm

    You are going to have to iterate through those select arrays and look for the option with selected = true and then store that value.

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

Sidebar

Related Questions

I have code that adds list items to an unordered list, and associated with
I have a controller that is being called twice from an ActionLink call. My
In my current project I have a custom ViewData that has (amongst others) the
I need help with this.. I have a viewdata with a list of clients
I have a controller action that is being executed by a link that was
I have the following code: ViewData.Model = from m in dataModel.Items where m.Loaned ==
Let's say I have a theoretical MVC framework that uses a ViewData object to
I have a strange problem whereby the ValidationSummary is not being displayed. However, the
I want all my pages to use have some viewdata. i need to get
Hi I have a view with several User Controls and I pass ViewData to

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.