The first view, containing the value i want to pass along looks like this:
@foreach (var item in Model.BlogPosts)
{
@item.Id <---This is the id i want to pass along
<div id="allphotos"><p>Från bildbank</p></div>
}
This is the Jquery triggered by the #allphotos. I need to have the @item.Id with me in here if possible.
$("#allphotos").click(function () {
$("<div></div>")
.addClass("dialog")
.appendTo("body")
.dialog({
close: function () {
$(this).remove();
},
modal: true,
height: 600,
width: 700
})
.load("/Home/AllPhotos");
});
The Jquery opens up a dialog and in this dialog i need to be able to acess the @item.Id somehow.
Here is the "final"-view where i need to acess the Id:
@model aPhoto_web.Models.AdminPages.AdminViewModel
/* Somewhere here i need to be able to read the @itemId in order to be able to pass it in the actionlink below. */
@foreach (var item in Model.Photographys)
{
<img id="imga" style="max-width: 100px;" src="@item.ImgUrl" />
<p>@item.ImgUrl</p>
@Html.ActionLink("Create New Part", "SetBlogImg", "Home", new {contId = @item.Id, imgurl = @item.ImgUrl}, null)
}
Is it possible to achieve this somehow? Thanks!