I have a "normal" cloud setup. I used the UaaS to clone down the project, which gave me a Web and a Core project. the core project holds my models and controller. the web my view and.
Now in the view i have some nested content which i loop like this:
@if (Model != null){
var items = Model.Content.Theme;
foreach (var item in items)
{
int nextPage = ((PublishedContentModel)item.GetProperty("themePage").Value).Id;
<h2 class="headline" data-id="@nextPage"> @nextPage</h2>
using (Html.BeginUmbracoForm<conservative.Core.Controllers.UserProfileController>("SelectedTopic", null))
{
<input onclick="myFunction('' + @nextPage + '')" type="submit" value="@item.GetPropertyValue("themeName")">
}
}}
only thing i need is to get the ID from the themePage and send it to my model , in the core project so i can use it in the controller. right now I'm trying to do in the myFunction
Whenever i try to pass the data in the foreach i only get the last ID. it is overridden. So in my controller i don't know which button a user have clicked on.
have tried to pass with:
using (Html.BeginUmbracoForm<UserProfileController>("SelectedTopic", null, new { ThemeId = TopicId }))
with no luck I'm sure i'm just missing some simple thing. Really hope someone out here knows what I'm missing
Passing Data to model from view
I have a "normal" cloud setup. I used the UaaS to clone down the project, which gave me a Web and a Core project. the core project holds my models and controller. the web my view and.
Now in the view i have some nested content which i loop like this:
only thing i need is to get the ID from the themePage and send it to my model , in the core project so i can use it in the controller. right now I'm trying to do in the myFunction
Whenever i try to pass the data in the foreach i only get the last ID. it is overridden. So in my controller i don't know which button a user have clicked on.
have tried to pass with:
with no luck I'm sure i'm just missing some simple thing. Really hope someone out here knows what I'm missing
kind regards a new cloud developer :) H5YR
Hi Mathias,
you could try something like this:
Then you will have nextPage value posted to the controller as ThemeId
Pawel
Hi Pawel
Found a solution
Now i just need to test if I can send more then one value :)
is working on a reply...