Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146477 | Aug 5,2019 05:35 PM UTC | Aug 19,2019 07:28 AM UTC | ASP.NET MVC - EJ 2 | 7 |
![]() |
Tags: MultiSelectDropdown |
@Html.EJS().MultiSelect("default").DataSource((IEnumerable<object>)ViewBag.data).Render()
@Html.EJS().Button("Btn").Content("Send").Render()
<script>
document.getElementById('Btn').onclick = function () {
var obj = document.getElementById('default').ej2_instances[0], value = JSON.stringify({ text: obj.text });
const Http = new XMLHttpRequest();
const url = '@Url.Action("About")';
Http.open("POST", url);
Http.setRequestHeader('Content-Type', 'application/json');
Http.send(value);
};
</script> |
public ActionResult Index()
{
ViewBag.data = new string[] { "Badminton", "Basketball", "Cricket", "Football", "Golf", "Gymnastics", "Hockey", "Tennis" };
return View();
}
[HttpPost]
public ActionResult About(string text)
{
//Get the value in text
return View();
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.