Home>ASP source code>Other categories

Added view bag data to the partial view control

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

    }
}

Create a div element for partial page controls

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

Read partial view controls using 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);
        });;
    }
Expand
Additional Information