第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

POST 上的模型為空

POST 上的模型為空

C#
撒科打諢 2023-07-09 17:33:08
我正在開發(fā)一個(gè)由一些我實(shí)際上不認(rèn)識(shí)的人開發(fā)的項(xiàng)目。我在 POST 方法上遇到問題。該模型實(shí)際上是空的??雌饋砟P蜎]有填充在視圖上。public ActionResult ConfermaRistampa(int IDTitolo, Ristampa ristampa) //Ristampa is the model{    //some code    if (ristampa.RichiestaRistampaWeb != null) //the field "RichiestaRistampaWeb" is null    {        ristampa.RichiestaRistampa = Utilities.ConverteFileInToFileUploadInfo(ristampa.RichiestaRistampaWeb, TipiDocumenti.Documento_Generico);    }}//this is the code of field on the Ristampa class declaration, in the set i noticed that value is nullpublic System.Web.HttpPostedFileBase RichiestaRistampaWeb{    get    {        return this.RichiestaRistampaWebField;    }    set    {        if ((object.ReferenceEquals(this.RichiestaRistampaWebField, value) != true))        {            this.RichiestaRistampaWebField = value;            this.RaisePropertyChanged("RichiestaRistampaWeb");        }    }}這就是整個(gè)模型的定義。顯然是使用 MVC 的 ASP.NET Core。我注意到模型的大多數(shù)屬性在設(shè)置器上都是空的。
查看完整描述

1 回答

?
Cats萌萌

TA貢獻(xiàn)1805條經(jīng)驗(yàn) 獲得超9個(gè)贊

在 cshtml 表單中,將 enctype 設(shè)置為“multipart/form-data”。否則文件將不會(huì)包含在您的模型中:


// Magic all the way to the right -->

@using (Html.BeginForm("ConfermaRistampa", "Abbonamenti", new { @IDTitolo = Request.QueryString["IDTitolo"] }, FormMethod.Post, new { enctype="multipart/form-data" }))



查看完整回答
反對(duì) 回復(fù) 2023-07-09
  • 1 回答
  • 0 關(guān)注
  • 149 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)