Error in Contact form

54 views Asked by At

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".

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:

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:

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

In 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?

1

There are 1 answers

0
vicky_864 On

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. I dont see what is wrong un the way that im doing it.