views:

63

answers:

1

I have the following jquery code that I've embedded inside of a View:

$(document).ready(
function()
{
    $(".dblclick").editable("http://localhost/Configuration/Edit", {
     id: 'nodeID',
     name: 'nodeValue',
     event: "dblclick",
     style: "inherit",
     submit: "Save",
     cancel: "Cancel",
     submitdata : {divison: "1"}
    });

});

The issue I'm running into is that I don't seem to be able to access the usual MVC-ness (is there a better phrase for this?) of the page.

Basically, what I'm trying to accomplish is that in the submitdata property (and also later on in the URL), I'd like to embed the actual id being passed into the page:

submitdata : {divison: <%= Html.Encode(Model.DivisionID) %>}

Is it not possible to access the model inside of a script block?

+2  A: 

Sure, that should work, as long as it's an on page script and not an external .js or something.

Are you getting an error? Only thing that looks like it might be an issue is in your first example you're passing a string, and in your server block, you're not. Try throwing quotes around it:

submitdata : {divison: "<%= Html.Encode(Model.DivisionID) %>"}
Chris Hynes
You're right. I'm not sure what I was doing incorrectly earlier, but it certainly seems to be working now. Thanks!
jerhinesmith