0

I'm trying to get the text boxes within my contact form to align. But am unsure how to do so. Iv messed with the css without any luck. I have also been trying to get this form to send to an email.. without luck. Any help is appreciated!

Contact.cshtml code:

    <legend>Registration Form</legend>
        <ol>

            <li>
                @Html.LabelFor(m => m.Reason)
                @Html.TextBoxFor(m => m.Reason)
            </li>
            <li>
                @Html.LabelFor(m => m.FirstName)
                @Html.TextBoxFor(m => m.FirstName, new { placeholder = "John " })
            </li>
            <li>
                @Html.LabelFor(m => m.LastName)
                @Html.TextBoxFor(m => m.LastName, new { placeholder = "Doe" })
            </li>
             <li>
                @Html.LabelFor(m => m.Username)
                @Html.TextBoxFor(m => m.Username, new {placeholder = "JohnDoe01" })
       ...............
    <input type="submit" value="Send" />
</fieldset>

Contact model:

public class ContactModel
{
[Required]
[Display(Name = "Reason for contact")]
   public string Reason { get; set; }

    [Required]
    [Display(Name = "First Name")]
   public string FirstName { get; set; }

    [Required]
    [Display(Name = "Last Name")]
   public string LastName { get; set; }

    [Required]
    [Display(Name = "User Name")]
    public string Username { get; set; ...........}

1 Answers1

0

Here's an answer with a good email example. You'll just need to pass your model back to a controller to handle the creation/sending of the email.

Send e-mail via SMTP using C#

Community
  • 1
  • 1
aw04
  • 10,857
  • 10
  • 56
  • 89