I added the following code in the ContactUsModel.cs:
[AllowHtml] [NopResourceDisplayName("ContactUs.Phone")] public string Phone { get; set; }
I updated the code in CommonController.cs:
//contact us page [NopHttpsRequirement(SslRequirement.No)] public ActionResult ContactUs() { var model = new ContactUsModel() { Email = _workContext.CurrentCustomer.Email, Phone = _workContext.CurrentCustomer.Phone,//this line added FullName = _workContext.CurrentCustomer.GetFullName(), DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnContactUsPage }; return View(model); }
I set the Nop.Web as the start up project, debugged, then built the project.
It still says:
Compiler Error Message: CS1061: 'Nop.Web.Models.Common.ContactUsModel' does not contain a definition for 'Phone' and no extension method 'Phone' accepting a first argument of type 'Nop.Web.Models.Common.ContactUsModel' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 45: Line 46: <div class="inputs"> Line 47: @Html.LabelFor(model => model.Phone) Line 48: <div class="input-box"> Line 49: @Html.TextBoxFor(model => model.Phone, new { @class = "phone", placeholder = T("ContactUs.Phone.Hint") })
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'Nop.Web.Models.Common.ContactUsModel' does not contain a definition for 'Phone' and no extension method 'Phone' accepting a first argument of type 'Nop.Web.Models.Common.ContactUsModel' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 45: Line 46: <div class="inputs"> Line 47: @Html.LabelFor(model => model.Phone) Line 48: <div class="input-box"> Line 49: @Html.TextBoxFor(model => model.Phone, new { @class = "phone", placeholder = T("ContactUs.Phone.Hint") })
the code in file ContactUsModel.cs is like:
using System.Web.Mvc; using FluentValidation.Attributes; using Nop.Web.Framework; using Nop.Web.Framework.Mvc; using Nop.Web.Validators.Common;
namespace Nop.Web.Models.Common { [Validator(typeof(ContactUsValidator))] public partial class ContactUsModel : BaseNopModel { [AllowHtml] [NopResourceDisplayName("ContactUs.Email")] public string Email { get; set; }
[AllowHtml] [NopResourceDisplayName("ContactUs.Phone")] public string Phone { get; set; }
[AllowHtml] [NopResourceDisplayName("ContactUs.Enquiry")] public string Enquiry { get; set; }
[AllowHtml] [NopResourceDisplayName("ContactUs.FullName")] public string FullName { get; set; }
public bool SuccessfullySent { get; set; } public string Result { get; set; }
public bool DisplayCaptcha { get; set; } } }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.