Beranda>Kode sumber ASP>Kategori lainnya

Menambahkan data tas tampilan ke kontrol tampilan sebagian

 namespace PartialView . Controllers
{
    public class HomeController : Controller
    {
        public IActionResult PartialPage ( )
        {
            ViewBag . data = new string [ ] { "Badminton" , "Basketball" , "Cricket" , "Football" , "Golf" , "Gymnastics" , "Hockey" , "Tennis" } ;
            return PartialView ( ) ;
        }

    }
} 

Buat elemen div untuk kontrol halaman parsial

">
 < div class =" row " >
    < div id =" PartialView " >  div >
     div > 

Baca kontrol tampilan sebagian menggunakan Ajax:

 function clickAjax ( ) {
        var ajax = new ej . base . Ajax ( '/PartialPage/index' , 'GET' , true ) ;
        ajax . send ( ) . then ( function ( result ) {
              var fragment = document . createElement ( 'div' ) ;
              fragment . innerHTML = result ;
              ej . base . append ( fragment . children , document . getElementById ( 'PartialView' ) , true ) ;
        } ) ; ;
    }
Memperluas
Informasi Tambahan