jsonresult Questions

9

Solved

If I have a controller like this: [HttpPost] public JsonResult FindStuff(string query) { var results = _repo.GetStuff(query); var jsonResult = results.Select(x => new { id = x.Id, name = ...
Timelag asked 14/2, 2011 at 6:36

2

Solved

In ASP.NET MVC 3, which is more correct to use: Json() or new JsonResult()? Either returns the same result. Thanks for helping solve an office debate.
Labana asked 20/7, 2011 at 18:20

3

I am Using speech = SpeechRecognizer.createSpeechRecognizer(getReactApplicationContext().getApplicationContext()); speech.setRecognitionListener(VoiceAppModule.this); recognizerIntent = new Inten...

15

Solved

In one of my controller actions I am returning a very large JsonResult to fill a grid. I am getting the following InvalidOperationException exception: Error during serialization or deserializatio...
Ipoh asked 17/4, 2011 at 9:56

5

Solved

I am trying to populate a ComboBox (Telerik RAD COmboBox) in a test ASP.NET MVC3 app. I have defined the ComboBox on my ASPX page and in the controller I have defined the action call that returns ...
Pimiento asked 5/5, 2011 at 16:53

1

Solved

Controller that worked in ASP.NET Core 2.0: [Produces("application/json")] [Route("api/[controller]")] [ApiController] public class GraficResourcesApiController : ControllerBase { private readon...
Sulfide asked 30/8, 2018 at 15:53

2

Solved

I have the code below, with works fine on the development machine but not when called from a remote browser... $.ajax({ type: 'POST', url: '@Url.Action("Action", "Controller")', data: { id: id ...
Gosnell asked 29/8, 2016 at 18:41

7

Solved

Is it possible to use JSON.NET as default JSON serializer in ASP.NET MVC 3? According to my research, it seems that the only way to accomplish this is to extend ActionResult as JsonResul...
Scammony asked 18/8, 2011 at 15:25

3

Solved

Is it possible to Multiple Objects Using ASP.NET MVC'S JsonResult Class.... Here is a controller method which returns json object of my records but i also want to pass the count value.... var mate...
Spicy asked 4/5, 2010 at 12:7

5

Solved

I am fetching records for a user based on his UserId as a JsonResult... public JsonResult GetClients(int currentPage, int pageSize) { if (Session["UserId"] != "") { var clients = clirep.FindAll...
Maracanda asked 19/5, 2010 at 11:20

6

I've set up this test method on a controller to strip out any complication to it. Based off of all the results I've found from searching this should work. I'm not sure what I'm missing here. publi...
Markham asked 6/6, 2014 at 6:16

0

I have a base class like this-ish: public class Baseclass { public string Id { get; set; } public string Type { get; set; } public string Name { get; set; } } ...and many classes that inheri...
Marduk asked 31/5, 2016 at 12:21

5

I have 2 questions: What is the difference between JSONResult and ActionResult? When to use JSONResult in MVC?

1

Solved

In ASP.NET MVC5 I have a controller with a JsonResult return type. Depending on parameters I want to return a 404, as this is descriptive of the user requesting non-existent data. I could throw n...
Kloman asked 8/5, 2015 at 19:25

2

Solved

So I have an object named Balance that contains: public class Balance { string balance1; string balance2; string currency; } and I'm trying to parse a JsonResult object that is returned by a ...
Schoolmarm asked 16/9, 2014 at 18:7

3

Solved

I have the following arbitrary JSON object(The field names may be changed). { firstname: "Ted", lastname: "Smith", age: 34, married : true } - public JsonResult GetData(??????????){ . . ....
Matildamatilde asked 22/8, 2012 at 8:31

4

I'm writing a multi-tenant application using a one database per tenant model. I have allowed each user account to access multiple tenants (as long as that tenant has given them access) Each page s...
Mortarboard asked 15/4, 2013 at 23:4

2

Solved

I have a method that returns return new System.Web.Mvc.JsonResult() { Data = new { Status = "OK", } } I need to write a unit test where I need to verify that jsonResult.Data.status= "OK". ...
Assumed asked 20/12, 2012 at 22:15

2

Solved

I have this following code: [HttpPost] public JsonResult Index2(FormCollection fc) { var goalcardWithPlannedDate = repository.GetUserGoalCardWithPlannedDate(); return Json(goalcardWithPlannedDat...
Schematism asked 28/5, 2012 at 9:23

3

Solved

I've got the following controller: public class HelloController { public ActionResult Index() { return View() } public ActionResult Hello() { return Json(new{ greeting = "hello, world!" },...
Hottempered asked 11/5, 2012 at 0:38

2

Solved

Context Language: C# Platform Version: Microsoft .Net Framework 4.0 Operating System: Windows 7 Professional (64-bit) Constraints: Microsoft MVC.Net 3.0 Problem I find myself looking at JSON a lot...
Chalcidice asked 27/3, 2012 at 22:52

2

Solved

I am building an application using MVC3, Razor view engine, Repository Pattern with Unit of Work and using EF4.1 Code First to define my data model. Here is a bit of background (gloss over it if y...
Paraformaldehyde asked 9/8, 2011 at 5:7

3

Solved

Having a string containing the following raw Json data (simplified for the sake of the question): var MyString = "{ 'val': 'apple' }"; How can I create a JsonResult object representing MyString...
Collect asked 21/10, 2010 at 20:43

1

Solved

I'm trying to pass Json to my View using ViewData Controller ViewData("JsonRegionList") = Json(RegionService.GetActiveRegions()) view $("input#UserRegion").autocomplete({ source:"<%: View...
Tonguing asked 26/7, 2010 at 2:9

4

Solved

I have an Action Method that I'd either like to return JSON from on one condition or redirect on another condition. I thought that I could do this by returning ActionResult from my method but doing...
Chichi asked 14/5, 2010 at 9:30

© 2022 - 2024 — McMap. All rights reserved.