Dab tsi yog render view hauv MVC?
Dab tsi yog render view hauv MVC?

Video: Dab tsi yog render view hauv MVC?

Video: Dab tsi yog render view hauv MVC?
Video: ົQhia ua hwj huaj zoo heev li_ xa rau kab nag thoj tau kawm saib txiav nw li movie 2024, Kaum ib hlis
Anonim

Views hauv MVC render raws li cov ntaub ntawv uas tawm ntawm tus maub los zoo li ViewData uas muaj cov qauv nrog rau qhov tseeb ViewData thiab ViewBag. Los ntawm Saib thiab ib co ntawm cov ntsiab lus cov ntaub ntawv ib ViewContext yog tsim uas yog ces siv rau ua tus saib nrog.

Tsis tas li ntawd, dab tsi yog rendering hauv MVC?

A ua kev txiav txim yog ib txoj hauv kev rau pej xeem ntawm chav tswj tswj. Koj tuaj yeem txhais a ua txoj kev ua kom rov qab tau cov ntaub ntawv, tab sis koj tuaj yeem siv nws tsuas yog siv tau yog tias nws xa rov qab ib txoj hlua HTML markup.

Tsis tas li ntawd, kuv yuav ua li cas thiaj ua tau ib feem ntawm kev pom? Ua raws li cov kauj ruam hauv qab no kom siv Ib Ntu Saib siv ntau txoj hauv kev.

  1. Tsim MVC daim ntawv thov. Qhib koj Visual Studio thiab tsim ib daim ntawv thov web tshiab. Siv cov ntawv MVC khoob.
  2. Ntxiv Ib Feem Saib. Hauv cov kauj ruam no koj yuav ntxiv Ib Ntu Saib nrog lub npe chaw nyob.
  3. Html. RenderPartial.
  4. Html. Ib nrab.
  5. Html. RenderAction.
  6. Html. Kev ua.

Tom qab ntawd, lo lus nug yog, dab tsi yuav tsum tau muab tso rau hauv qhov kev pom hauv MVC lub moj khaum?

MVC Framework - Saib . Raws li pom nyob rau hauv thawj zaug introductory tshooj, Saib yog ib feem cuam tshuam nrog daim ntawv thov tus neeg siv interface. Cov no Saib yog feem ntau khi los ntawm cov qauv ntaub ntawv thiab muaj extensions xws li html, aspx, cshtml, vbhtml, thiab lwm yam.

HTML RenderPartial yog dab tsi?

RenderPartial (HtmlHelper, String) Renders qhov teev ib feem saib los ntawm kev siv qhov teev tseg HTML tus pab. RenderPartial (HtmlHelper, String, Object) Renders qhov teev ib feem saib, dhau nws ib daim ntawv theej ntawm ViewDataDictionary khoom tam sim no, tab sis nrog cov cuab yeej Model teem rau tus qauv teev.

Pom zoo: