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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:19:04+00:00 2026-06-02T04:19:04+00:00

@Html.ActionLink(Edit, EditArticle, new { ArticleID = article.ArticleID }) I retrieved Article by ArticleID and

  • 0
@Html.ActionLink("Edit", "EditArticle", new { ArticleID = article.ArticleID })

I retrieved Article by ArticleID and return to edit page like this:

public ActionResult EditArticle(Guid ArticleID)
{
    AddArticleModel AddArticleModel = new AddArticleModel();
    AddArticleModel.Categories = entity.TBL_CATEGORIES.Select(a => a);
    AddArticleModel.Article = dbo.SelectArticleById(ArticleID);

    return View(AddArticleModel);
}

There is no problem until here.

And in my editing page I’m changing some attributes of article (not all attributes).For example I’m changing title, content, and updateddate. Like this:

@model DunyaYazilim.Models.AddArticleModel

@{
    ViewBag.Title = "EditArticle";
    Layout = "~/Views/Shared/_LayoutAuthor.cshtml";
}

@using (Html.BeginForm((string)ViewBag.FormAction, "Author"))
{
    @Html.ValidationSummary(true, "Makale gönderilirken bir hata oluştu. Lütfen daha sonra tekrar deneyin.")

    <div>
        <div class="label_header">@Html.Label("Kategori Seçiniz:")</div>
        <div>@Html.DropDownList("CategoryID", new SelectList(Model.Categories, "CategoryID", "Name"),Model.Article.TBL_CATEGORIES.Name)</div>
        <div class="label_header">@Html.Label("Makale Başlık:")</div>
        <div>@Html.TextBoxFor(m => m.Article.Title, new { @class = "my_textbox" })</div>
        <div class="label_header">@Html.Label("Makale Açıklama:")</div>
        <div>@Html.TextAreaFor(m => m.Article.Description, new { @class = "my_textarea" })</div>
        <div class="label_header">@Html.Label("Makale İçerik:")</div>
        <div>@Html.TextAreaFor(m => m.Article.ArticleContent, new { @class = "my_textarea" })</div>
        <div><input type="submit" value="Gönder" class="my_button" /></div>
    </div>
}

And then I post it to:

[HttpPost]
public ActionResult EditArticle(AddArticleModel AddArticleModel, String CategoryID)
{
    //TODO: update database...
    return View(AddArticleModel);
}

But unchanged attributes are return null(ArticleID, UserID, etc).So I cant Update the database, Because I dont have ArticleID after posting. What is the reason for this?

Thanks.

  • 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-02T04:19:05+00:00Added an answer on June 2, 2026 at 4:19 am

    MVC doesn’t maintain anything for you between requests. When you post to your action, it will post only the values that you have set up in your form. As you don’t have your article id or user id in the form (or anywhere else, e.g. route or query string), MVC won’t know about them during model binding for your EditArticle action.

    If you want the extra details to be sent through with your post, you can put hidden fields in the form, e.g.

    @Html.HiddenFor(m => m.Article.Id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following @Html.ActionLink(Edit, EditProg, new { id = item.ID }) I like
I have an action like so: @Html.ActionLink(dinner.Title, Details, new { id=dinner.DinnerID }) and a
I'd like to write: <a href='@Html.LinkGenerator'>Edit</a> instead of: @Html.ActionLink(Edit, Edit) Where @Html.LinkGenerator is the
I have something like in MVC (I am using MVC c# using razor): @Html.ActionLink(Edit,
The Html.ActionLink <li> ${Html.ActionLink<HomeController>(c => c.Edit(ViewData.Model.Id, ViewData.Model.Title), Edit)} </li> When created as html shows
So Html.ActionLink(Report, SendMail, Misc, new { id = Model.ImageID }, null) will generate a
I try to rewrite and customize @Html.ActionLink , in one of overloads of this
I am designing a custom HTML helper and I would like to execute Html.ActionLink
this is my code ProductController.cs public ActionResult Details(string id) { product productx = productDB.products.Single(pr
I have an index page for listing products. From this page I would like

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.