Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:22:27+00:00 2026-06-04T19:22:27+00:00

I have a page with 2 input type=text.. @model MVC3.ViewModel.TalkToUsVM @using (Html.BeginForm()) { <ul>

  • 0

I have a page with 2 input type=text..

@model MVC3.ViewModel.TalkToUsVM

@using (Html.BeginForm())
{
    <ul>
        <li>@Html.TextBoxFor(m => m.TalkToUsRequest.Name)</li>
        <li>@Html.TextBoxFor(m => m.TalkToUsRequest.Email)</li>
    </ul>

    <input type="submit" value="Save"/>
}

in my controller I do this:

[HttpPost]
public ActionResult Create(TalkToUsRequest talkToUsRequest)
{
    var vm = new TalkToUsVM();

    if (TryValidateModel(talkToUsRequest))
    {
        vm.Result = "Success";

        return View("Create",vm);
    }

    vm = new TalkToUsVM
    {
        Result = "Errrooooooor",
        TalkToUsRequest = talkToUsRequest
    };

    return View(vm);
}

so the problem.. when my model is valid, I set the result to “Success” and in this point vm.TalkToUsRequest is null.. but when page is rendered, all fields are with the same value that when I submited.. even I setting vm.TalkToUsRequest = null!!
How can I clear this fields?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:22:29+00:00Added an answer on June 4, 2026 at 7:22 pm

    So in this scenario you have to clear your model state if you return back to the same view.
    Try following:

        ModelState.Clear();
        return View(vm);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple text box and button type input on my page. <input
If a textarea or input (type text) element has focus in a HTML page
I have a page with File html input field and a Submit button as
I have a JS script that appends to the HTML page the pairs: input
I have an input control on a page like this: <input type=button causesvalidation=false runat=server
I have multiple input textboxes in my page. I want to reset particular text
I have a page where the input type always varies, and I need to
I have simplified my page and here what I have: <html> <head> <meta http-equiv=content-type
I have these three fields in my jsp page. <td> <html:text property=my_dto.number1 </html:text> </td>
I have this form: @using (Html.BeginForm(Update, MyController, FormMethod.Post, new { id = frmEdit }))

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.