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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:46:49+00:00 2026-06-15T11:46:49+00:00

I got a stored procedure which i show in the view for edits. I

  • 0

I got a stored procedure which i show in the view for edits. I made a strong type of the stored procedure. When i edit the fields and then press the save button, the parameter “cm” is always empty. And it’s not showing a list but just 1 record.

The custom model:

public class CustomModel
    {
        public string Description { get; set; }
        public System.Data.Linq.ISingleResult<GetItems_ListResult> ItemList { get; set;}
    }

This part of the controller sends it to the view:

 public ActionResult Details(int id)
 {
    var row = dataContext.Items.FirstOrDefault(x => x.ItemID == id);
    var cm = new CustomModel();
    cm.ItemList = dataContext.GetItem_List(row);
    cm.Description = row.Description;

    return View(cm);
 }

This controller receives data from the view:

[HttpPost]
public ActionResult UpdateItems(CustomModel cm)
{

   return RedirectToAction("Index");
}

This is the view:

@model TestWeb.Models.CustomModel


@using (Html.BeginForm("UpdateItems", "Item", FormMethod.Post))
{

     <table>
            <tr>
                <th>Name</th>
                <th>Description</th>
            </tr>
        @foreach (var p in Model.ItemList.ToList())
        {
            <tr>
                <td>
                    @Html.HiddenFor(mdl => p.ItemId)
                </td>
                <td>@p.Name</td>
                <td>
                    @Html.EditorFor(mdl => p.Description)
                </td>
            </tr>
        }
    </table>

    <p>
        <input type="submit" value="save" />
    </p>
}

What am i doing wrong here?

  • 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-15T11:46:50+00:00Added an answer on June 15, 2026 at 11:46 am

    Try the following:

    Make a GetItems_ListResult.cshtml like this:

    <tr>
     <td>
        @Html.HiddenFor(mdl => mdl.ItemId)
     </td>
      <td>@Model.Name</td>
     <td>
        @Html.EditorFor(mdl => mdl.Description)
     </td>
    </tr>
    

    Then in your for loop do this:

    @for (int i = 0; i < Model.ItemList.Count(); i++)
    {
       @Html.EditorFor(m => m.ItemsList[i])
    }
    

    Update: I didn’t quite notice you were using an ISingleResult. You could do this instead:

    //Since it'll have none or one element..
    if(Model.ItemList != null  && Model.ItemList.Any())
    {
      @Html.EditorFor(m => m.ItemList.First())
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a stored procedure which runs this to create a new ticket number:
I've got a stored procedure, which selects 1 record back. the stored procedure could
I have a SSRS report which runs from a stored procedure. I've got 2
I've got a stored procedure which seems to be my bottle neck in my
I've got a stored procedure which used to take around 25s to execute. I've
i've got a question about the tables and stored procedures which are created by
I've got a Stored Procedure in SQL Server 2005 and when I run it
I've got a stored procedure in Oracle: procedure Test(results OUT gencursor, id in number)
I have got the below stored procedure to return the list of Id, parentId
I've got a call to a stored procedure, that is basically an INSERT stored

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.