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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:12:24+00:00 2026-06-18T03:12:24+00:00

I have view model (used for filtering) with property: int? Id {get;set;} In my

  • 0

I have view model (used for filtering) with property:

int? Id {get;set;}

In my view I have sth like that:

@Html.EditorFor(m=>m.Id)

When I submit form I get error:

Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, 
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.

I dont want to do sth like that:

@Html.TextBox("Model.Id", Model.Id.HasValue ? MOdelId.Value : 0)

When I checked in Fiddler there is parameter ID with proper vaue but I can’t even debbug because it doesn’t get into Action method.

Can you help me?

PS sorry for my english

  • 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-18T03:12:25+00:00Added an answer on June 18, 2026 at 3:12 am

    For the debugger to reach the breakpoint, it should first get pass the model binder. Model binder is the thing that magically binds values from your HTTP request to the model. All parsing will happen at the model binder and if it fails there, you will never hit the breakpoint in your action method.

    Try the following on your view

    @Html.EditorFor(m=>m.Id, new {name = ‘Id’, id=’Id’})
    

    or

    @Html.TextBoxFor(m=>m.Id)
    

    Cheers

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

Sidebar

Related Questions

I have one property on my view model that is used in a select
I have a view model that looks like this public class ViewModelRound2 { public
I have the following view model, used for editing Person objects in an HTML
I have a View Model object that has a depednency property called IsSearching ;
I have a view model that is used as the data source for my
I have a view model coming from the server as json like this {
I have a view model with an Email address property and a Confirm Email
I have this view @model IEnumerable<ViewModelRound2> ... <snip> ... @{ using (Html.BeginForm(new { round1Ring3Bids
I have a view model with a couple of properties that are not displaying
I have a view model with a property Fields which is an ObservableCollection<FieldVM> .

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.