Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143161 | Mar 6,2019 10:16 PM UTC | Mar 8,2019 04:02 AM UTC | ASP.NET Core - EJ 2 | 3 |
![]() |
Tags: Dropdown List |
<form id="form-element" method="post">
<ejs-dropdownlist id="ddAccessType" width="200" name="AccessType" dataSource="Model.AccessTypes" value="Model.AccessType" placeholder="Select Access Type" popupHeight="220px">
</ejs-dropdownlist>
<div class="form-group">
<div class="col-md-10">
<button type="submit" class="e-control e-btn">Submit</button>
</div>
</div>
</form> |
public class IndexModel : PageModel
{
public string AccessType { get; set; }
public string[] AccessTypes { get; set; }
public void OnGet()
{
AccessTypes = new ListItems().getListItems();
AccessType = "TSAdmin";
}
[HttpPost]
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
AccessTypes = new ListItems().getListItems();
AccessType = Request.Form["AccessType"];
return Page();
}
}
public class DataModel
{
public string AccessType { get; set; }
public string[] AccessTypes { get; set; }
} |
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.