How to pass HTML label value to PageModel on form submission - asp.net-core

Not sure if it can be done, but how would I assign an HTML label value to a BindProperty.
In my PageModel, I have a List of DateTimes I generate and this list is used in the Razor Page and displayed on rows. (submissionDates is the list)
<tbody>
#foreach (var item in Model.submissionDates)
{
<tr>
<td>
<div class="form-group">
<label asp-for="Timesheet.TimesheetStart" class="control-label">#item.Date</label>
</div>
</td>
<td>
<div class="form-group">
<label asp-for="Timesheet.TimesheetNotes" class="control-label">Submission Notes</label>
<textarea asp-for="Timesheet.TimesheetNotes" class="form-control" id="NotesTextArea" rows="3"></textarea>
</div>
</td>
<td>
<div class="form-group">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
</td>
</tr>
}
</tbody>
In the OnPost of the PageModel I need the date from the row submitted to add to the Model.
public async Task<IActionResult> OnPostAsync()
{
string weekSelected = Request.Form["Timesheet.TimesheetStart"];
var emptyTimesheet = new Timesheet()
{
Submitted = DateTime.Now,
TimesheetStart = DateTime.Parse(weekSelected),
TimesheetEnd = TimesheetStart.AddDays(7),
ColleagueID = UserColleague,
BranchID = (int)branchFilter
};
if ( await TryUpdateModelAsync<Timesheet>(
emptyTimesheet,
"timesheet",
s => s.TimesheetNotes
))
{
_context.Timesheets.Add(emptyTimesheet);
await _context.SaveChangesAsync();
return RedirectToPage("./Index");
}
return Page();
}
I have tried using Model Binding like I have with TimesheetNotes but that was null, the attempt shown above is reading straight from the Form Response and this is also null.
Am I going about this the wrong way or in my scenario is getting that label value not possible?

You can use a hidden input,which name is Timesheet.TimesheetStart,.net core bind data with name attribute.And you need to set its value with #item.Date.Then you need to put form outside <tr></tr>,so that when you click the button,it will only post the values of the current row rather than all the rows.
<tbody>
#foreach (var item in Model.submissionDates)
{
<form method="post">
<tr>
<td>
<div class="form-group">
<label asp-for="Timesheet.TimesheetStart" class="control-label">#item.Date</label>
<input hidden name="Timesheet.TimesheetStart" value=#item.Date>
</div>
</td>
<td>
<div class="form-group">
<label asp-for="Timesheet.TimesheetNotes" class="control-label">Submission Notes</label>
<textarea asp-for="Timesheet.TimesheetNotes" class="form-control" id="NotesTextArea" rows="3"></textarea>
</div>
</td>
<td>
<div class="form-group">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
</td>
</tr>
</form>
}
</tbody>
result:

Only INPUT elements will be available in the Request.Form. You can use an HTML Hidden field for each label. With hidden fields, you can do model binding as well.
<div class="form-group">
<label asp-for="Timesheet.TimesheetStart" class="control-label">#item.Date</label>
<input type="hidden" asp-for="Timesheet.TimesheetStart" />
</div>

Related

Too few arguments to function App\Http\Controllers\TimeUserController::save(), 1 passed in Controller

I have an error:
Too few arguments to function App\Http\Controllers\TimeUserController::save(), 1 passed in C:\xampp\htdocs\lreport\vendor\laravel\framework\src\Illuminate\Routing\Controller.php on line 54 and exactly 3 expected
I want to insert data into the TimeUser table in the database. But before the data is stored in the table, I want to check first whether the id_user has been registered or not.
I'm trying to create a controller like this:
public function save($id_user, Request $request){
$id_user = TimeUser::findOrFail($id_user);
if ($id_user == null) {
$user = Auth::user();
$id = $request->id;
$id_user = $user['id'];
$time_start = date('Y-m-d H:i:s');
$time_user['id'] = $id;
$time_user['id_user'] = $id_user;
$time_user['time_start'] = $time_start;
TimeUser::create($time_user);
return redirect()->intended('home');
} else {
$time_start = date('Y-m-d H:i:s');
$time_user['time_start'] = $time_start;
TimeUser::create($time_user);
return redirect()->intended('home');
}
return redirect()->intended('/');
}
And route in web like this:
Route::controller(TimeUserController::class)->group(function () {
Route::post('/timeuser/save', 'save');
Route::get('/timeuser/save/{$id_user}', 'save');
});
in my blade.php
<form method="POST" action="{{ url('/timeuser/save')}}">
#csrf
<div class="btn-group me-2" role="group" aria-label="First group">
<button type="submit" class="btn btn-primary">START</button>
</div>
</form>
<br>
<div class="btn-group me-2" role="group" aria-label="First group">
<button type="button" class="btn btn-success">GO TO CLASSROOM</button>
</div>
<div class="btn-group me-2" role="group" aria-label="First group">
<button type="button" class="btn btn-danger">FINISH</button>
</div>
<br>
<table>
<tr>
<td>Duration</td>
<td>:</td>
<td></td>
</tr>
<tr>
<td>Last Logout </td>
<td> :</td>
<td></td>
</tr>
</table>
</div>
What and how should I fix my controller part?

ASP .NET core Razor page - Avoid refreshing the page

I have tow buttons in one Form, first button for add website info to a local table and second button for add social media info to another table, after all info added locally,
then I can click on 'add all info' button for add all info in same time to database.
My question is how can I add info to a table without refreshing the page?
AddAllInfo.cshtml:
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewWebSiteInfo.websiteName">Website URL</label>
<input type="text" asp-for="NewWebSiteInfo.websiteName" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewWebSiteInfo.websiteUrl">Website URL</label>
<input type="text" asp-for="NewWebSiteInfo.websiteUrl" class="form-control" />
</div>
<button type="submit" validatedisable="True" asp-page-handler="AddWebsiteInfo" class="btn btn-primary" >Add Website info</button>
<div class="mb-3">
#if (AddInfoModel.WebSitelist.Count > 0)
{
<div class="col-12 border p-3">
<table class="table table-striped table-bordered">
<thead style="background-color:lightgray">
<tr>
<th>WebsiteName</th>
<th>websiteURL</th>
</tr>
</thead>
<tbody>
#foreach (Website item in AddAllInfoModel.WebSitelist)
{
<tr>
<td>#item.WebsiteName</td>
<td>#item.websiteURL</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</br>
</br>
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewSocialMediaInfo.SocialMediaName">Social Media</label>
<input type="text" asp-for="NewSocialMediaInfo.SocialMediaName" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewSocialMediaInfo.SocialMediaAccount">Account</label>
<input type="text" asp-for="NewSocialMediaInfo.SocialMediaAccount" class="form-control" />
</div>
<button type="submit" validatedisable="True" asp-page-handler="AddSocialMediaInfo" class="btn btn-primary" >Add socil Media info</button>
<div class="mb-3">
#if (AddInfoModel.SocialMedialist.Count > 0)
{
<div class="col-12 border p-3">
<table class="table table-striped table-bordered">
<thead style="background-color:lightgray">
<tr>
<th>SocialMediaName</th>
<th>SocialMediaAccount</th>
</tr>
</thead>
<tbody>
#foreach (SocialMedia item in AddAllInfoModel.SocialMedialist)
{
<tr>
<td>#item.SocialMediaName</td>
<td>#item.SocialMediaAccount</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</br>
<div class="col-4 offset-2">
<button type="submit" class="btn btn-primary form-control"> Add all info </button>
</div>
</form> ```
AddAllInfo.cshtml.cs:
public void OnPostAddSocialMediaInfo()
{
SocialMedialist.Add(new SocialMedia { SocialMediaName = NewSocialMediaInfo.SocialMediaName,
SocialMediaAccount=NewSocialMediaInfo.SocialMediaAccount});
}
public void OnPostAddWebsiteInfo()
{
WebSitelist.Add(new WebSite { WebSiteName = NewWebSiteInfo.WebsiteName,
websiteUrl =NewWebSiteInfo.websiteUrl});
}
You can use js to pass data to handler,and then use js to add html to tbody,here is a demo to add data to table without refresh the page:
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewWebSiteInfo.websiteName">Website URL</label>
<input type="text" asp-for="NewWebSiteInfo.websiteName" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewWebSiteInfo.websiteUrl">Website URL</label>
<input type="text" asp-for="NewWebSiteInfo.websiteUrl" class="form-control" />
</div>
<input type="button" onclick="AddWebsiteInfo()" class="btn btn-primary" value="Add Website info">
<div class="mb-3">
#if (AddInfoModel.WebSitelist.Count > 0)
{
<div class="col-12 border p-3">
<table class="table table-striped table-bordered">
<thead style="background-color:lightgray">
<tr>
<th>WebsiteName</th>
<th>websiteURL</th>
</tr>
</thead>
<tbody>
#foreach (Website item in AddAllInfoModel.WebSitelist)
{
<tr>
<td>#item.WebsiteName</td>
<td>#item.websiteURL</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</br>
</br>
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewSocialMediaInfo.SocialMediaName">Social Media</label>
<input type="text" asp-for="NewSocialMediaInfo.SocialMediaName" class="form-control" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label" asp-for="NewSocialMediaInfo.SocialMediaAccount">Account</label>
<input type="text" asp-for="NewSocialMediaInfo.SocialMediaAccount" class="form-control" />
</div>
<input type="button" onclick="AddSocialMediaInfo()" class="btn btn-primary" value="Add socil Media info">
<div class="mb-3">
#if (AddInfoModel.SocialMedialist.Count > 0)
{
<div class="col-12 border p-3">
<table class="table table-striped table-bordered">
<thead style="background-color:lightgray">
<tr>
<th>SocialMediaName</th>
<th>SocialMediaAccount</th>
</tr>
</thead>
<tbody>
#foreach (SocialMedia item in AddAllInfoModel.SocialMedialist)
{
<tr>
<td>#item.SocialMediaName</td>
<td>#item.SocialMediaAccount</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</br>
<div class="col-4 offset-2">
<input type="button" onclick="AddAllInfo()" class="btn btn-primary" value="Add all info">
</div>
</form> ```
js:
#section Scripts{
<script>
function AddWebsiteInfo() {
var NewWebSiteInfo = {
'websiteName': $("#NewWebSiteInfo_websiteName").val(),
'websiteUrl': $("#NewWebSiteInfo_websiteUrl").val()
};
$.ajax({
type: 'POST',
url: '?handler=AddWebsiteInfo',
data: NewWebSiteInfo,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
dataType: 'json',
success: function (data) {
var html = "<tr><td>" + data.websiteName + "</td><td>" + data.websiteUrl + "</td></tr>";
$("tbody")[0].innerHTML = $("tbody")[0].innerHTML + html;
}
});
}
function AddSocialMediaInfo() {
var NewAddSocialMediaInfo = {
'SocialMediaName': $("#NewSocialMediaInfo_SocialMediaName").val(),
'SocialMediaAccount': $("#NewSocialMediaInfo_SocialMediaAccount").val()
};
$.ajax({
type: 'POST',
url: '?handler=AddSocialMediaInfo',
data: NewAddSocialMediaInfo,
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
dataType: 'json',
success: function (data) {
var html = "<tr><td>" + data.socialMediaName + "</td><td>" + data.socialMediaAccount + "</td></tr>";
$("tbody")[1].innerHTML = $("tbody")[1].innerHTML + html;
}
});
}
function AddAllInfo() {
AddWebsiteInfo();
AddSocialMediaInfo();
}
</script>
}
handler:
[BindProperty]
public WebSiteInfo NewWebSiteInfo { get; set; }
[BindProperty]
public SocialMediaInfo NewSocialMediaInfo { get; set; }
public void OnGet()
{
}
public JsonResult OnPostAddWebsiteInfo()
{
WebSitelist.Add(new WebSite { WebSiteName = NewWebSiteInfo.WebsiteName,
websiteUrl =NewWebSiteInfo.websiteUrl});
return new JsonResult(NewWebSiteInfo);
}
public JsonResult OnPostAddSocialMediaInfo()
{
SocialMedialist.Add(new SocialMedia { SocialMediaName = NewSocialMediaInfo.SocialMediaName,
SocialMediaAccount=NewSocialMediaInfo.SocialMediaAccount});
return new JsonResult(NewSocialMediaInfo);
}
The best way to do this is to run the post request in javascript, this will not refresh the page.
2nd option is by calling the get method again at the end of the post method and then passing the model with the data to the get. So that when the page refreshes the data is filled in again

How to submit related entities in asp.net core razor page form?

I have two models Invoice and Product, one invoice can have many products as usual.
public class InvoiceModel
{
public string Name { get; set; }
public string Description { get; set; }
[Required(ErrorMessage = "Products are required!")]
public List<ProductModel> Products { get; set; }
}
public class ProductModel
{
public string Name { get; set; }
public string Model { get; set; }
public string Brand { get; set; }
}
and i want to create a new invoice with products.
so when i generate razor page for invoice create, it only generate input fields for Name and Description,
then i added product table, and button to the form, when the user clicks on add product button, a new row is added to the table using jsscript.
I have referred to this Url for binding complex object lists, but when I submit the form newly added products are not posted to the server-side.
Can anyone point me to the right way to resolve this issue,
Thanks
Try my codes bellow and my test result in screenshot.
#page
#model IndexModel
#{
}
<h3>#ViewData["confirmation"]</h3>
<form class="form-horizontal" method="post">
<div class="form-group">
<label for="Name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input asp-for="CC.Name" type="text" class="form-control">
</div>
</div>
<div class="form-group">
<label for="Description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<input asp-for="CC.Description" type="text" class="form-control">
</div>
</div>
<script type="text/javascript">
var mytab = document.getElementById("myTable");
var i = 0;
function myfunction() {
document.getElementById("myTable").style.display = "block";
document.getElementById("myTable").insertRow(-1).innerHTML =
'<td> <input type="text" name="cc.Products[' +i + '].Name" /> </td><td> <input type="text" name="cc.Products[' + i + '].Model" /> </td><td> <input type="text" name="cc.Products[' + i + '].Brand" /> </td>';
i++;
}
</script>
<button type="button" onclick="myfunction()">Add Product</button>
<table id="myTable" style="display: none;" class="table table-striped">
<tr>
<th>Name</th>
<th>Model</th>
<th>Brand</th>
</tr>
</table>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Create</button>
</div>
</div>
</form>
enter image description here
enter image description here
According to your description ,I guess you used the wrong input tag's name this is the reason why you coulnd't get the ProductModel's vaule.
If your post method's parameter name like public InvoiceModel ProductModels { get; set; }, then the table's name should like this ProductModels.Products[0].Name and ProductModels.Products[1].Name.
More details, you could refer to below codes:
<form class="form-horizontal" method="post">
<div class="form-group">
<label for="Name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input asp-for="ProductModels.Name" type="text" class="form-control">
</div>
</div>
<div class="form-group">
<label for="Description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<input asp-for="ProductModels.Description" type="text" class="form-control">
</div>
</div>
<button type="button" onclick="myFunction()">Add Product</button>
<table id="myTable">
<tr>
<td>Name</td>
<td>Model </td>
<td>Brand</td>
</tr>
<tr>
<td>
<input type="text" name="productModels.Products[0].Name" />
</td>
<td>
<input type="text" name="productModels.Products[0].Model" />
</td>
<td>
<input type="text" name="productModels.Products[0].Brand" />
</td>
</tr>
<tr>
<td>
<input type="text" name="productModels.Products[1].Name" />
</td>
<td>
<input type="text" name="productModels.Products[1].Model" />
</td>
<td>
<input type="text" name="productModels.Products[1].Brand" />
</td>
</tr>
</table>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Create</button>
</div>
</div>
</form>
Backend:
[BindProperty]
public InvoiceModel ProductModels { get; set; }
public void OnGet()
{
}
public void OnPost(InvoiceModel productModels)
{
//var Name = Request.Form["Name"];
//var Description = Request.Form["Description"];
var Name = Request.Form["Name"];
var Model = Request.Form["Model"];
var Brand = Request.Form["Brand"];
ViewData["confirmation"] = $"{Name},{Model},{Brand}";
}
Result:

Confirmation Boostrap modal posting

I'm attempting to take a confirm event and turning it into a modal. Here is the original code:
#page
#model AllCustomerModel
#{
ViewData["Title"] = "AllCustomer";
}
<h2>All Customers</h2>
<p>
<a asp-page="Customer">Create New Customer</a>
</p>
<table class="table">
<thead>
<tr>
<th>
#Html.DisplayName("Name")
</th>
<th>
#Html.DisplayName("Address")
</th>
<th>
#Html.DisplayName("Country")
</th>
<th>
#Html.DisplayName("City")
</th>
<th>
#Html.DisplayName("Phone")
</th>
<th>Edit | Delete</th>
</tr>
</thead>
<tbody>
#foreach (var item in Model.customerList)
{
<tr>
<td>
#Html.DisplayFor(modelItem => item.Name)
</td>
<td>
#Html.DisplayFor(modelItem => item.Address)
</td>
<td>
#Html.DisplayFor(modelItem => item.Country)
</td>
<td>
#Html.DisplayFor(modelItem => item.City)
</td>
<td>
#Html.DisplayFor(modelItem => item.Phone)
</td>
<td>
<a asp-page="./EditCustomer" asp-route-id="#item.CustomerID">Edit</a> |
<a asp-page="./AllCustomer" onclick="return confirm('Are you sure you want to delete this item?');" asp-page-handler="Delete" asp-route-id="#item.CustomerID">Delete</a>
</td>
</tr>
}
</tbody>
</table>
Code Behind,
public ActionResult OnGetDelete(int? id)
{
if (id != null)
{
var data = _context.CustomerTB.Find(id);
_context.Remove(data);
_context.SaveChanges();
}
return RedirectToPage("AllCustomer");
}
Here is what I've tried/currently trying (for brevity sake, I haven't pasted the MVP)
<button type="button" class="btn btn-primary" data-toggle="modal" data-id="#item.CustomerID" data-target="#myModal">
Delete
</button>
<div class="modal fade" id="myModal">
<form id="myForm" method="post">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Delete Customer</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
Are you sure you want to delete this customer?
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-danger">Yes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">No</button>
</div>
</div>
</div>
</form>
</div>
Code Behind,
[BindProperty]
public Customer Customer { get; set; }
public void OnPost()
{
Customer customer = Customer;
if (customer != null)
_context.Remove(_context.CustomerTB.Find(customer.CustomerID));
customerList = _context.CustomerTB.ToList();
}
It will hit the OnPost method but the customer object is empty. Is this a proper way to tackle this issue? What more do I need to add in order to pick up the object on the code behind?
You need to pass the selected customerId to modal(with a hidden type) by javascript when click the button,and then bind the Customer.CustomerId in page using asp-for tag helper.
For example:
<button type="button" class="btn btn-primary myButton" data-toggle="modal" data-id="#item.CustomerID" data-target="#myModal">
Delete
</button>
<div class="modal fade" id="myModal">
<form id="myForm" method="post">
<div class="modal-dialog">
<div class="modal-content">
//..
<div class="modal-body">
<input type="hidden" class="hiddenid" asp-for="Customer.CustomerID" />
Are you sure you want to delete this customer?
</div>
//..
</div>
</div>
</form>
</div>
#section Scripts{
<script>
$('.myButton').on('click', function (event) {
var passedID = $(this).data('id');
$(".modal-body .hiddenid").val(passedID);
});
</script>
}

Display product options in Wishlist module - DNN Hotcakes

The current default view for the wish list module shows the product but not the options that were selected.
How can this be changed so that the option label and selected value are displayed as well?
I'm going to make an assumption that you're using Hotcakes 1.xx and not version 2.xx for this, but the code should be the same for both. I just only tested it in 01.10.04.
I've built an example of how to do this based upon the Cart view you'll find in the viewset already.
The original Wish List view looks like this:
#model IEnumerable<Hotcakes.Modules.Core.Areas.Account.Models.SavedItemViewModel>
<h2>#Localization.GetString("SavedItems")</h2>
#Html.Raw((string)TempData["messages"])
<div class="hc-record-list hc-wishlist clearfix">
#foreach (var item in Model)
{
<div class="hc-record">
<div class="hc-recimage">
<a href="#item.FullProduct.ProductLink">
<img src="#item.FullProduct.ImageUrls.SmallUrl" border="0" alt="#item.FullProduct.ImageUrls.SmallAltText" />
</a>
</div>
<div class="hc-recname">
<h2>#item.FullProduct.Item.ProductName</h2>
<div class="hc-recdescription">
#Html.Raw(item.FullProduct.Item.LongDescription)
</div>
</div>
<div class="hc-reccontrols">
<table class="dnnFormItem">
<tr>
<td class="hc-recprice">
#Html.Raw(item.FullProduct.UserPrice.DisplayPrice(true))
</td>
<td>
#if(!item.FullProduct.Item.IsGiftCard && !item.FullProduct.Item.IsUserSuppliedPrice)
{
using (Html.BeginHccRouteForm(HccRoute.WishList, new { action = "addtocart" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="#item.SavedItem.Id" />
<input class="dnnPrimaryAction" type="submit" value="#Localization.GetString("AddToCart")" />
}
}
</td>
<td>
#using (Html.BeginHccRouteForm(HccRouteNames.WishList, new { action = "delete" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="#item.SavedItem.Id" />
<input type="submit" class="hc-delete" value="#Localization.GetString("RemoveSavedItem")" />
}
</td>
</tr>
</table>
</div>
</div>
}
</div>
Below the description of the product, I added the following snippet:
#using Hotcakes.Commerce.Catalog
#if (item.SavedItem.SelectionData != null && item.SavedItem.SelectionData.OptionSelectionList != null && item.SavedItem.SelectionData.OptionSelectionList.Count > 0)
{
<div class="clearfix">
#Html.Raw(item.FullProduct.Item.Options.CartDescription(item.SavedItem.SelectionData.OptionSelectionList))
</div>
}
That makes the entire view look like this:
#using Hotcakes.Commerce.Catalog
#model IEnumerable<Hotcakes.Modules.Core.Areas.Account.Models.SavedItemViewModel>
<h2>#Localization.GetString("SavedItems")</h2>
#Html.Raw((string)TempData["messages"])
<div class="hc-record-list hc-wishlist clearfix">
#foreach (var item in Model)
{
<div class="hc-record">
<div class="hc-recimage">
<a href="#item.FullProduct.ProductLink">
<img src="#item.FullProduct.ImageUrls.SmallUrl" border="0" alt="#item.FullProduct.ImageUrls.SmallAltText" />
</a>
</div>
<div class="hc-recname">
<h2>#item.FullProduct.Item.ProductName</h2>
<div class="hc-recdescription">
#Html.Raw(item.FullProduct.Item.LongDescription)
</div>
#if (item.SavedItem.SelectionData != null && item.SavedItem.SelectionData.OptionSelectionList != null && item.SavedItem.SelectionData.OptionSelectionList.Count > 0)
{
<div class="clearfix">
#Html.Raw(item.FullProduct.Item.Options.CartDescription(item.SavedItem.SelectionData.OptionSelectionList))
</div>
}
</div>
<div class="hc-reccontrols">
<table class="dnnFormItem">
<tr>
<td class="hc-recprice">
#Html.Raw(item.FullProduct.UserPrice.DisplayPrice(true))
</td>
<td>
#if(!item.FullProduct.Item.IsGiftCard && !item.FullProduct.Item.IsUserSuppliedPrice)
{
using (Html.BeginHccRouteForm(HccRoute.WishList, new { action = "addtocart" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="#item.SavedItem.Id" />
<input class="dnnPrimaryAction" type="submit" value="#Localization.GetString("AddToCart")" />
}
}
</td>
<td>
#using (Html.BeginHccRouteForm(HccRouteNames.WishList, new { action = "delete" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="#item.SavedItem.Id" />
<input type="submit" class="hc-delete" value="#Localization.GetString("RemoveSavedItem")" />
}
</td>
</tr>
</table>
</div>
</div>
}
</div>