Cshtml yog dab tsi hauv ASP NET MVC?
Cshtml yog dab tsi hauv ASP NET MVC?

Video: Cshtml yog dab tsi hauv ASP NET MVC?

Video: Cshtml yog dab tsi hauv ASP NET MVC?
Video: How to Link CSS to HTML Document 2024, Kaum ib hlis
Anonim

cshtml ua yog cov ntaub ntawv txuas ntxiv uas hais txog lub tshuab razor saib. Ntxiv rau qhov ncaj html, cov ntaub ntawv no kuj muaj C# code uas tau muab tso ua ke ntawm tus neeg rau zaub mov ua ntej cov nplooj ntawv raug server mus txog qhov browser..

Tsis tas li ntawd, Cshtml sawv cev rau dab tsi?

cshtml stands rau C# HTML. Cov kev pom no tso cai rau Razor syntax, uas yog kev sib xyaw ntawm HTML sib xyaw nrog C#.

_layout Cshtml hauv MVC yog dab tsi? cshtml ua " file nyob rau hauv "Sib koom" folder. Cov ntaub ntawv " _ Layout . cshtml ua " sawv cev rau layout ntawm txhua nplooj ntawv hauv daim ntawv thov. Right-click rau ntawm Shared folder hauv Solution Explorer ces mus rau "Ntxiv" yam khoom thiab nyem rau ntawm "Saib". Tam sim no tus Saib tau raug tsim.

Kuj Paub, _viewstart Cshtml hauv MVC yog dab tsi?

_Viewstart . cshtml ua yog siv los tso UI logic thoob plaws Views hauv daim nplaub tshev, qhov twg nws nyob. Qhov no txhais tau tias, cov kev xav hauv ib daim ntawv tais ceev tseg uas muaj _Viewstart . cshtml ua yuav tau rendered nrog nws. Piv txwv li: Yog hais tias peb saib cov views folder ntawm ib MVC qhov project, peb yuav pom _Viewstart.

MVC Razor yog dab tsi?

ASP. NET MVC - Razor . Razor yog ib tug markup syntax uas cia koj embed server-raws li code rau hauv lub vev xaib siv C# thiab VB. Net. Nws tsis yog lus programming. Nws yog server sab markup lus. Razor tsis muaj kev sib txuas rau ASP. NET MVC vim Razor yog lub hom phiaj dav dav templateing cav.

Pom zoo: