简体   繁体   English

联系表格中的错误

[英]Error in Contact form

I need to show in the Comment text area the id of the property about it are consulting, I took it from the view Details where have a button "Consult". 我需要在“注释”文本区域中显示有关其正在咨询的属性的ID,我从“详细信息”视图中获取了该属性,该按钮具有“咨询”按钮。

In the Details view: 在详细信息视图中:

<a class="btn btn-primary" href="@Url.Action("Contact", "Home", new {PropertyId = @Model.PropertyModel.Property.PropertyId})#consult">
<i class="icon-envelope">
</i>
@Resources.Property.Details.Consulta
</a>

In HomeController: 在HomeController中:

public ActionResult Contact(string PropertyId)
{
    UserRepository userRepository = new UserRepository();
    User user = userRepository.GetUserByEmail(User.Identity.Name);
    ContactModel model = new ContactModel(user);
    model.Comment = PropertyId;
    return View(model);
}

In ContactModel: 在ContactModel中:

[Required]
[Display(Name = "Comment", ResourceType = typeof(Resources.Entities.Names))]
public string Comment { get; set; }

In Contact.cshtml: 在Contact.cshtml中:

<div class="control-group">
    @Html.LabelFor(m => m.Comment, new { @class = "control-label" })
    <div class="controls">
        @Html.TextAreaFor(m => m.Comment, new {@rows = "6", @style="width:80%;"})
        @Html.ValidationMessageFor(m => m.Comment) 
    </div>
</div>

Do you know how to make it work? 你知道如何使它工作吗?

Thanks for answering! 谢谢回答! The problem is that doesnt appear the id info (wich i give to the controller with url action) in the text área called comment. 问题是在名为注释的文本área中没有显示id信息(我通过url操作将其提供给控制器)​​。 I dont see what is wrong un the way that im doing it. 我看不到即时通讯方式出了什么问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM