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

  • Home
  • SEARCH
  • 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 7706587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:09:45+00:00 2026-06-01T00:09:45+00:00

My Model Class as follows: public class Employee { public Guid ID { get;

  • 0

My Model Class as follows:

public class Employee
{
    public Guid ID { get; set; }
    [Required]
    [Remote("CheckName","Employee",ErrorMessage="Already Exists...!")]
    public String EmployeeName { get; set; }
    public String EmployeeAddress { get; set; }
    [Required]
    public DateTime DateOfBirth { get; set; }
    public decimal Salary { get; set; }
    public String Department { get; set; }
    public DateTime HireDate { get; set; }
}

My Action in Controller as Follows:

  [HttpGet]
    public JsonResult CheckName(string Name)
    {
        return Json(Name.Equals("MyString"), JsonRequestBehavior.AllowGet);
    }

When i executed this i am getting a following exception

NullReferenceException:
Object reference not set to n instance of an object

In the View, form contains a textbox and a submit button.
If You are not clear with these things, please let me know to perform a remote validation.

  • 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-01T00:09:46+00:00Added an answer on June 1, 2026 at 12:09 am

    Not sure how you’re rendering the Textbox in question, but if you’re using:

    @Html.TextboxFor(x => x.EmployeeName) // or
    @Html.EditorFor(x => x.EmployeeName) // or
    @Html.Textbox("EmployeeName")
    

    The field name of the input will be rendered as <input name=”EmployeeName” /> and model binding will not be able to resolve it to the Name parameter of the CheckName method, thus attempting to execute

    Name.Equals("MyString")
    

    while Name is null and causing the NullReferenceException. If you change the parameter name of the CheckName method to EmployeeName, that should cause model binding to resolve the parameter to the name of the textbox.

    This is all contingent on me understanding the situation and making some assumptions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My model is as follows: public class testCreateModel { public string s1 { get;
I have the following object model: class ObjectA{ public string Description {get;set;} } class
I have a model defined as follows: public class Link extends Model { @Required
Main model classes are as follows : public class UserAddressesForm { @NotEmpty private String
I have a field in my model class that's coded as follows: public string
I have a model as follows: public class User : System.Web.Security.MembershipUser { public int
I have a View Model that is defined as follows: public class VariableViewModel {
Lets say I have some view models set up as follows: public class User
I am having a class as follows public class UserRoleModel { public string Role
I have implemented a custom Table Model as follows: public class MyTableModel extends AbstractTableModel

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.