Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi There,
I am having Partial view macro activities.cshtml which calls ActivitiesForm.cshtml partial view
@Html.Partial("ActivitiesForm", new ActivitiesModel())
ActivitiesForm.cshtml
@using (Html.BeginUmbracoForm("FindActivity", "ActivitiesSurface", null, new { @class = "lb-jumbo-form" })) { @Html.ValidationSummary(true) <div class="form-group"> @Html.LabelFor(x => x.Activity) @Html.DropDownListFor(x => x.Activity, Model.getActivities(), "Any", new { @class = "form-control" }) </div> <div class="form-group"> @Html.LabelFor(x => x.Centre) @Html.DropDownListFor(x => x.Centre, Model.getCentres(), "Any", new { @class = "form-control" }) </div> <div class="form-group"> @Html.LabelFor(x => x.ActivityType) @Html.DropDownListFor(x => x.ActivityType, Model.getActivityTypes(), "Any", new { @class = "form-control" }) </div> <div class="form-group"> @Html.LabelFor(x => x.Day) @Html.DropDownListFor(x => x.Day, Model.getDays(), "Any", new { @class = "form-control" }) </div> <div class="form-group text-right"> <input type="submit" value="submit" class="btn" /> <a href="">Reset</a> </div> }
ActivitiesSurfaceController.cs
public ActionResult FindActivity(ActivitiesModel model) { string caption = ""; if (model.ActivityType != null && model.ActivityType != "Any") { caption += model.ActivityType + " "; } if (model.Activity != null && model.Activity != "Any") { caption += model.Activity; } else { caption += "Activities"; } if (model.Centre != null && model.Centre != "Any") { caption += " at " + ShortenCentreName(model.Centre); } if (model.Day != null && model.Day != "Any") { caption += " (" + model.Day + ")"; } ViewBag.caption=caption; ActivitiesModel ac = new ActivitiesModel(); var dt = ac.getSportsActivities(model); ViewBag.ActivityCount = dt.Rows.Count; ViewBag.activities = dt; return CurrentUmbracoPage(); }
I am having below code in ActivitiesForm.cshtml to get show results but this is not updating, I can see results when debugging but not rendered.
Any help is much appreciated
@{ var odd = true; } @if (@ViewBag.ActivityCount == 0) { <h2>No activities found</h2><p>Please choose different options.</p> } else { if (ViewBag.activities != null) { <table class="table"> <caption>@ViewBag.caption</caption> <tr> <th class="lb-table-header">Activity</th> <th class="lb-table-header">Day/time</th> <th class="lb-table-header">Centre</th> <th class="lb-table-header">Type</th> <th class="lb-table-header">More</th> </tr> @foreach (var activity in ViewBag.activities) { <tr class="@(odd ? "lb-table-row-highlight" : "lb-table-row")"> <td>@activity.Activity</td> <td>@activity.Day<br />@[email protected]</td> <td>@activity.Centre</td> <td>@activity.Type</td> <td><a href="" class="lb-cta-1-1 lb-sports-more">More</a></td> </tr> odd = !odd; } </table> } }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Partial view macro result
Hi There,
I am having Partial view macro activities.cshtml which calls ActivitiesForm.cshtml partial view
ActivitiesForm.cshtml
ActivitiesSurfaceController.cs
I am having below code in ActivitiesForm.cshtml to get show results but this is not updating, I can see results when debugging but not rendered.
Any help is much appreciated
is working on a reply...