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 8318639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:02:43+00:00 2026-06-08T22:02:43+00:00

After I run, when I type the value in Username textbox and clicked submit

  • 0

After I run, when I type the value in Username textbox and clicked submit button.
In Controller I check the object its showing null values…. If i remove the forloop and list its working…… give me a solution

Controller :

 [HttpGet]
        public ActionResult Index()
        {
            return View();
        }


        [HttpPost]
        public ActionResult Index(LogonViewModel lvm)
        {
            LogonViewModel lv = new LogonViewModel();

            return View();
        }

Model:

 public class LogonViewModel
    {
        [Required(ErrorMessage = "User Name is Required")]
        public string UserName { get; set; }
    }

View

@model IList<clientval.Models.LogonViewModel>

@{
    ViewBag.Title = "Index";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>   
<script src="../../assets/js/val.js" type="text/javascript"></script>

@using (Html.BeginForm())
{
    for (int i = 0; i < 1; i++)
    {  
    @Html.LabelFor(m => m[i].UserName)
    @Html.TextBoxFor(m => m[i].UserName)
     @Html.ValidationMessageFor(per => per[i].UserName)

    <input type="submit" value="submit" />
    }
}
  • 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-08T22:02:45+00:00Added an answer on June 8, 2026 at 10:02 pm

    Your POST controller action must take a collection because that’s what you have in your view:

    [HttpPost]
    public ActionResult Index(IList<LogonViewModel> lvm)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a small issue, I am trying to run a $(form#picform).submit after
I got build error after run in Snow Leopard (MacPort v.1.8.0) sudo port install
My jar will not run after I compiled it. I use this ant build
GPS is not launching at first run after clicking OK of Would like to
How can I make a function run after a certain element has finished animating?
How do I get a function to run after all the fadeOuts in the
I need change first image in Galleria fullscreen theme ( link ) after Galleria.run().
I am trying to transfer from Cherrypy to Bottle & Gevent(server). After I run:
When I run make (after running qmake) I get the following error: /usr/bin/ld: cannot
I want that screenCheck function show run only after Validation of #contact_email . But

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.