Click here to Skip to main content
       

ASP.NET

 
AnswerRe: .i cant select master page as well as place code n seperate file textbox in vs 2008. Pinmemberjkirkerx10-Jan-13 13:54 
QuestionStart Up for Project Required PinmemberZiad Aslam8-Jan-13 20:31 
AnswerRe: Start Up for Project Required PinmvpRichard MacCutchan8-Jan-13 21:58 
GeneralRe: Start Up for Project Required PinmemberZiad Aslam8-Jan-13 22:26 
GeneralRe: Start Up for Project Required PinmvpRichard MacCutchan8-Jan-13 23:48 
AnswerRe: Start Up for Project Required PinmemberJ4amieC9-Jan-13 1:42 
GeneralRe: Start Up for Project Required PinmemberZiad Aslam9-Jan-13 2:07 
QuestionMVC 4.0 and JQuery .ajax [modified] PinmemberAnalogNerd8-Jan-13 9:50 
I'm trying to do a post back to a controller with $.ajax and all I get in the controller is null for my object.
 
Here's my setup for the class:
 public class ApplicationLinkViewModel : MappableModel 
    {
        public string ApplicationLinkId { get; set; }
 
        public string ApplicationId { get; set; }
 
        public string DisplayText { get; set; }
 
        public string Link { get; set; }
    }
 
And for the controller:
 [HttpPost]
        public JsonResult SaveLink(ApplicationLinkViewModel link)
        {
          var responseModel = new ResponseModel();
          return this.Json(responseModel);
        }
 
As you can see I'm doing nothing in the controller right now, I just have two lines so I can set a breakpoint and check out the link variable which is always null.
 
The JQuery function is :
$.ajax({
        type: "POST",
        cache: false,
        dataType: 'json',
        url: "Item/SaveLink",
        data: JSON.stringify({ ApplicationId : "1", DisplayText: "test", Link : "linked", ApplicationLinkId: "2" }),
        contentType: 'application/json; charset=utf-8',
        success: function(data) {
            if (data.Success) {
                window.searchApplications();
                window.showDetails(applicationId);
            }
        },
        error: function(data) {
            alert("Error occurred : \n\n" + data.Message);
        }
    });
 
I've tried several other approaches, and nothing I do seems to work, the object passed into my controlled is always null.
 
Does anyone have any ideas? For what it is worth I am (stuck) using IE8.
 

EDIT: SOLVED
I'm going to go drown myself now. The problem was the name of my parameter "link". It must be reserved or something even though the code never complained. At any rate I changed my Controller to this and it works now:
 
public JsonResult SaveLink(ApplicationLinkViewModel linkViewModel


modified 8-Jan-13 15:50pm.

QuestionSample project ajax file upload with progress bar Pinmembersheshagirirao N8-Jan-13 0:25 
AnswerRe: Sample project ajax file upload with progress bar PinmvpSandeep Mewara8-Jan-13 4:05 
QuestionGrouping Columns in Grid View PinmemberAmitTalekar7-Jan-13 21:45 
AnswerRe: Grouping Columns in Grid View PinmvpSandeep Mewara7-Jan-13 21:58 
GeneralRe: Grouping Columns in Grid View PinmemberAmitTalekar7-Jan-13 23:54 
QuestionHow to make gridview coloum in hyperlink and get the values in lightbox Pinmemberkrishnavaradharajan7-Jan-13 3:26 
AnswerRe: How to make gridview coloum in hyperlink and get the values in lightbox PinmvpSandeep Mewara7-Jan-13 3:57 
GeneralRe: How to make gridview coloum in hyperlink and get the values in lightbox Pinmemberkrishnavaradharajan7-Jan-13 5:23 
AnswerRe: How to make gridview coloum in hyperlink and get the values in lightbox Pinmemberpiyush_dobariya7-Jan-13 19:41 
AnswerRe: How to make gridview coloum in hyperlink and get the values in lightbox PinmemberDavid Mujica8-Jan-13 4:48 
QuestionBrowser Compatibilty Pinmemberravitejapammi7-Jan-13 0:54 
AnswerRe: Browser Compatibilty PinmvpSandeep Mewara7-Jan-13 3:53 
GeneralRe: Browser Compatibilty Pinmemberravitejapammi17-Jan-13 21:21 
GeneralRe: Browser Compatibilty PinmvpSandeep Mewara18-Jan-13 0:50 
GeneralJavaScript - window.print() not working in Android mobile browsers Pinmemberravitejapammi24-Jan-13 0:08 
QuestionHow can I delete a Column of XLSX file with EPPlus in web application? [modified] Pinmembercawboy_iran6-Jan-13 21:00 
AnswerRe: How can I delete a Column of XLSX file From EPPlus in web application? PinmvpSandeep Mewara6-Jan-13 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 27 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid