Lỗi 'HtmlHelper<dynamic>' has no applicable method named 'Hidden' MVC

Thảo luận trong 'Lập Trình Website MVC5 & MVC6' bắt đầu bởi seolagi, 16/8/18.

  1. seolagi
    Tham gia ngày:
    16/4/14
    Bài viết:
    1,029
    Đã được thích:
    81
    Điểm thành tích:
    48
    Lỗi: 'HtmlHelper<dynamic>' has no applicable method named 'Hidden' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax
    Mã:
    @Html.Hidden("IdCategoryList", ViewBag.VBCate.ToString(), new { @id = "IdCategoryList" })
    • Mình có chuyển nó qua .ToString() rùi mà sao nó vẫn không hiểu nhỉ, giờ làm sao để add giá trị mặc định đây giúp mình với.
    • Cảm ơn
     
    Cảm ơn đã xem bài:

    Lỗi 'HtmlHelper<dynamic>' has no applicable method named 'Hidden' MVC

  2. admin
    Tham gia ngày:
    22/5/13
    Bài viết:
    4,904
    Đã được thích:
    1,199
    Điểm thành tích:
    113
    Giới tính:
    Nam
    Của bạn đây:
    HTML:
    @Html.Hidden("IdCategoryList", (string)ViewBag.VBCate.ToString(), new { @id = "IdCategoryList" })
    • Thêm (string) trước ViewBag nữa bạn nhé.
     


Chủ để tương tự : Lỗi 'HtmlHelper<dynamic>'
Diễn đàn Tiêu đề Date
Lập Trình Website MVC5 & MVC6 Lỗi: You are debugging a Release build of .dll. Using just My Code in Visual Studio 2019 8/6/23
Lập Trình Website MVC5 & MVC6 Lỗi: There is already an open DataReader associated with this Command which must be closed first 30/10/20
Lập Trình Website MVC5 & MVC6 Lỗi: The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities. 27/3/20
Lập Trình Website MVC5 & MVC6 Lấy Entity Value old cũ sau đó Update không bị lỗi Asp.net MVC 27/3/20
Lập Trình Website MVC5 & MVC6 Lỗi Maximum request length exceeded khi upload file mvc asp.net c# 5/8/19