Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Admin - prevent for exceptions when using ActionLink with an empty string

supportde4413bd0a3c
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/_CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/_CreateOrUpdate.TabInfo.cshtml
index ade0770ec..a0c9ae4ed 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/_CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/_CreateOrUpdate.TabInfo.cshtml
@@ -113,7 +113,7 @@
<div class="col-md-9 col-sm-9">
<input asp-for="ProductId" type="hidden" />
<label class="control-label" id="purchased-with-product-name">
- @if (!string.IsNullOrEmpty(Model.ProductId))
+ @if (!string.IsNullOrEmpty(Model.ProductId) && !string.IsNullOrEmpty(Model.ProductName))
{
@Html.ActionLink(Model.ProductName, "Edit", "Product", new { id = Model.ProductId })
}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Info.cshtml
index 1129fc493..914c8369a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/_CreateOrUpdate.Info.cshtml
@@ -511,7 +511,7 @@
<span asp-validation-for="VisibleIndividually"></span>
</div>
</div>
- @if (!string.IsNullOrEmpty(Model.Id) && !string.IsNullOrEmpty(Model.AssociatedToProductId))
+ @if (!string.IsNullOrEmpty(Model.Id) && !string.IsNullOrEmpty(Model.AssociatedToProductId) && !string.IsNullOrEmpty(Model.AssociatedToProductName))
{
<div class="form-group">
<admin-label asp-for="AssociatedToProductId" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/_CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/_CreateOrUpdate.TabInfo.cshtml
index 58751da25..39edfd3a3 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/_CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/_CreateOrUpdate.TabInfo.cshtml
@@ -80,10 +80,13 @@
{
for (int i = 0; i < Model.AssociatedCustomers.Count; i++)
{
- @Html.ActionLink(Model.AssociatedCustomers[i].Email, "Edit", "Customer", new { id = Model.AssociatedCustomers[i].Id }, new { })
- if (i != Model.AssociatedCustomers.Count - 1)
+ if (!string.IsNullOrEmpty(Model.AssociatedCustomers[i].Email))
{
- <text>, </text>
+ @Html.ActionLink(Model.AssociatedCustomers[i].Email, "Edit", "Customer", new { id = Model.AssociatedCustomers[i].Id }, new { })
+ if (i != Model.AssociatedCustomers.Count - 1)
+ {
+ <text>, </text>
+ }
}
}
}