Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootgrid and .Net Core Ajax Posting not working ... #421

Open
temilson opened this issue Jan 22, 2019 · 0 comments
Open

Bootgrid and .Net Core Ajax Posting not working ... #421

temilson opened this issue Jan 22, 2019 · 0 comments

Comments

@temilson
Copy link

temilson commented Jan 22, 2019

I've used bootgrid on numerous projects to date and love it!

However I'm trying to use in now on a new .Net Core project and whenever I try to initialize the grid using ajax, I'm getting a 415 'Unsupported Media Type' error.

I'm assuming it has something to do with this:
https://andrewlock.net/model-binding-json-posts-in-asp-net-core/

Here is my JS:
$("#grid-sentinels-list").bootgrid({
searchSettings: {
delay: 100,
characters: 3
},
ajax: true,
url: "/projects/allsentinels",
}
}).on("loaded.rs.jquery.bootgrid", function () {
});

Here is my controller:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult AllSentinels([FromServices]MessagingContext _context,bootGridObject obj)
{
//Code goes here but of course is never hit due to 415 error.
}

Here is my bootGridObject:
public class bootGridObject
{
public int current { get; set; }
public int rowCount { get; set; }
public string searchPhrase { get; set; }
public string id { get; set; }
}

However so far I haven't been able to get it working.

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant