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

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

Viewmodel 失去了它的一些值

Viewmodel 失去了它的一些值

C#
泛舟湖上清波郎朗 2023-07-09 17:43:13
抱歉,如果這個(gè)問(wèn)題已經(jīng)有答案,但我找不到。提交表單時(shí),我的ViewModel會(huì)丟失一些值。具體來(lái)說(shuō),錯(cuò)誤對(duì)象會(huì)丟失其值。我不明白為什么。我沒有任何東西可以覆蓋它。我非常感謝我能得到的任何幫助。我嘗試刪除= new ...(),但這會(huì)使程序拋出錯(cuò)誤不是對(duì)象的實(shí)例視圖模型:namespace Vacation.ViewModels{    public class EditScheduleViewModel : BaseViewModel    {        public EditScheduleError Error { get; set; } = new EditScheduleError();        public string GotoSched { get; set; } = "";        public string GotoURL { get; set; } = "";        public string Title { get; set; } = "";        public bool isLast { get; set; } = false;        public User Employee { get; set; } = new User();        public int TotalWeeks { get; set; } = 2;        public Schedule ScheduleActive { get; set; } = new Schedule();        public DateTime LastSchedEndDate { get; set; }        public List<Schedule> ScheduleAll { get; set; } = new List<Schedule>();        public List<ScheduleDay> Days { get; set; } = new List<ScheduleDay>(new ScheduleDay[28]);        public List<int> ClinicIds { get; set; } = new List<int>(new int[28]);        public List<ClinicInfo> ClinicsList { get; set; } = new List<ClinicInfo>();        public EditScheduleViewModel ()        {            ProjectName = "Scheman";        }    }    public class EditScheduleError    {        public bool Overlaps { get; set; }        public EditScheduleOverlappingError OverlappingError { get; set; } = new EditScheduleOverlappingError();    }    public class EditScheduleOverlappingError    {        public bool OverlapsBefore { get; set; }        public bool OverlapsAfter { get; set; }        public int IdBefore { get; set; }        public int IdAfter { get; set; }        public EditScheduleOverlappingErrorResolutions Resolution { get; set; } = new EditScheduleOverlappingErrorResolutions();    }    public class EditScheduleOverlappingErrorResolutions    {        public bool ChangeThis { get; set; }        public bool ChangeOther { get; set; }    }}這不是控制器的全部部分...您需要更多嗎?預(yù)期的行為是錯(cuò)誤保持其值,即使在我提交了表單之后也是如此。
查看完整描述

1 回答

?
holdtom

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

通過(guò)將其添加到視圖中,它起作用了!由于某種原因我必須設(shè)置這些值......不確定為什么。但是嘿,只要它有效,對(duì)吧?:)


@Html.HiddenFor(x => x.MyError.Overlaps, new { @Value = Model.MyError.Overlaps })

        @Html.HiddenFor(x => x.MyError.OverlappingError.OverlapsAfter, new { @Value = Model.MyError.OverlappingError.OverlapsAfter })

        @Html.HiddenFor(x => x.MyError.OverlappingError.OverlapsBefore, new { @Value = Model.MyError.OverlappingError.OverlapsBefore })

        @Html.HiddenFor(x => x.MyError.OverlappingError.IdAfter, new { @Value = Model.MyError.OverlappingError.IdAfter })

        @Html.HiddenFor(x => x.MyError.OverlappingError.IdBefore, new { @Value = Model.MyError.OverlappingError.IdBefore })



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

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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