help please
I have a view with many buttons...each button has unique ID. I want to open a partial view in a jquery dialog box. I can see the dialog box and even see the partial form in it, but I cannot get a parameter passed to it. the following script works...but notice I have hard coded the id in the url. How do I put a variable in there instead of a hardcoded id number. Thanks very much
<script>
var ASeatId; //this code works
function showPersonDialog(seatId) {
ASeatId = seatId;
$('#dialog').dialog('open');
}
$('#dialog').dialog({
autoOpen: false,
width: 800,
resizable: false,
title: 'Edit Guest',
modal: true,
open: function (event, ui) {
var url = '@Html.Raw(Url.Action("Guest", "Seat", new{seatID=3}))';
$(this).load(url);
},
buttons: {
"Save": function () {
$(this).dialog("save");
// prevent the default action, e.g., following a link
return false;
},
"Close": function () {
$(this).dialog("close");
// prevent the default action, e.g., following a link
return false;
}
}
});
</script>
so when I step through controller code
public ActionResult Guest(int? seatId)
{
return PartialView("_Guest");
//return PartialView("_Guest");
}
I can see the number 3
I would like to pass a variable instead based on the button click...this code that follows does NOT work
<script> ///this code does not work
var ASeatId;
function showPersonDialog(seatId) {
ASeatId = seatId;
$('#dialog').dialog('open');
}
$('#dialog').dialog({
autoOpen: false,
width: 800,
resizable: false,
title: 'Edit Guest',
modal: true,
open: function (event, ui) {
var url = '@Html.Raw(Url.Action("Guest", "Seat", new{seatID=ASeatID}))'; ///this being the variable
$(this).load(url);
},
buttons: {
"Save": function () {
$(this).dialog("save");
// prevent the default action, e.g., following a link
return false;
},
"Close": function () {
$(this).dialog("close");
// prevent the default action, e.g., following a link
return false;
}
}
});
</script>
Thanks again