I have a ASP.Net MVC JsonResult function in which I want to return the contents of a PartialView (The content has to be loaded using Ajax, and for some reason I can't return a PartialViewResult).
To render the PartialView I need the ViewContext object.
How do you get the current ViewContext object within an Action method? I don't even ...
I am trying to use asp.net MVC controllers JsonResult to CRUD db records.
e.g.
GET /Config/Folder/1 - will return a json serialized LinqToSql entity
POST /Config/Folder - will send form data back to the server to be deserialized and persisted back to the database.
I am using james newton-kings JSON.net to serialize the entity, althou...
I have some stored JSON strings stored in the DB which I want to return to the client as JsonResult . I know that Json(object) turns an object into JsonResult but what if I already have the result in a string ? can I cast it to JsonResult
...
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 materials = consRepository.FindAllMaterials().AsQueryable();
var count = materials.Count();
var results = new PagedList<MaterialsObj>(materials, c...
I am using jquery with asp.net mvc.... Is my data option valid or am i missing some thing...
$.ajax({
type:"POST",
url: "Materials/GetRecords",
data: "{'currentPage':1,'pageSize':5}",
Any suggestion....
EDIT:
I am calling a function from a view page,
<asp:Content ID="Content2" ContentPlaceHolderI...
In a template i have the following code
<script>
var url="/mypjt/my_timer"
$.post(url, paramarr,
function callbackHandler(dict)
{
alert('got response back');
if (dict.flag == 2)
{
alert('1');
$.jGrowl("Data could not be ...
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 this causes the error "not all code paths return a value"
Can anyone tell me what I'm doing wrong? Or how to achieve the desired result?
He...
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.FindAllClients().AsQueryable();
var count = clients.Count();
var results = new PagedList<ClientBO>(clients, currentPage - 1, pag...
I am returning this from a json result from a controller,
var genericResult = new { redirectUrl = Url.Action("Create", "Registration")
, isRedirect = true };
return Json(genericResult);
but when i inspect through firebug,
{"redirectUrl":"/","isRedirect":true}
if (data.isRedirect) {
...
I know there are a few topics on this, but I seem to be fumbling my way through with no results. I'm trying to use a controller to return JSON results to my Bing Maps functions.
Here's what I have for my controller (yes it is properly returning JSON data.
Function Regions() As JsonResult
Dim rj As New List(Of RtnJson)()
rj.Add...
I'm running into a strange issue in more than one page of my ASP.NET MVC site. When I POST a form and the Model is NOT valid, I try to return the same view so that I can see the errors - however, instead of the page getting reloaded, I get a pop-up download box that says that the file is in "application/json" format. As you can see fro...
I'm trying to pass Json to my View using ViewData
Controller
ViewData("JsonRegionList") = Json(RegionService.GetActiveRegions())
view
$("input#UserRegion").autocomplete({
source:"<%: ViewData("JsonRegionList").ToString %>",
minLength: 3,
but the problem I'm running into is the output source ...
I have a strange problem in json date parsing. I am using the following to parse the json date:
dateFormat(new Date(parseInt(user.RegDate.substr(6))), "mm/dd/yyyy")
When my local machine (Client) is in different timezone from the server timezone, then it returns different dates when i try to retrieve the registered date of the users. ...
I have a scenario where I need the following functionality:
In View I have call as:
$.ajax({
type: "POST",
async: false,
dataType: 'json',
url: "ControllerA/ActionA",
data: { var1: some_value },
success: function (data) {
if (data == true) {
form.submit();
}
else if (data == fa...
hello,
how can i see the raw json output of mvc 2 jsonresult? i need this to enable me debug the results.
thanks
...
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?
I tried to use the Json(object) method. but it handles the raw json data as an string -logically :P-. So the returned HTTP response looks...