亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

asp.net MVC中,某個頁面中的Model是怎么指定的?

asp.net MVC中,某個頁面中的Model是怎么指定的?

滄海一幻覺 2018-12-31 04:00:23
asp.net MVC中,某個頁面中的Model是怎么指定的?
查看完整描述

1 回答

?
Smart貓小萌

TA貢獻1911條經驗 獲得超7個贊


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

Controller代碼如下:

 

public class HomeController : Controller

    {

        public ActionResult Index()

        {

            return View();

        }

        [HttpPost]

        public ActionResult Index(IndexModel model)

        {

            return View(model);

        }

     }

      

 視圖,位于~/Views/Home/Index.cshtml,代碼

 @model IndexModel

 <html>

     網頁代碼

 </html>

 其中IndexModel為你的Model,通過@model來指定這個頁面的對象類型為IndexModel

  

 希望你明白~

 


查看完整回答
反對 回復 2019-01-06
  • 1 回答
  • 0 關注
  • 393 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號