Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How do I fix 'object' does not contain a definition for 'Value'?

How do I fix 'object' does not contain a definition for 'Value'?

Scheduled Pinned Locked Moved ASP.NET
helpquestiondebuggingtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11369001
    wrote on last edited by
    #1

    I have a foreach statement. When I run my code in debug mode, I am getting the following error. I am not sure how to fix it. Google search shows may ways of doing it. Error: 'object' does not contain a definition for 'Value' and no accessible method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) My code behind

    foreach(string caseNumber in userEnteredCaseNumberList)
    {
    EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
    newCandidate.CaseNbr = caseNumber;
    newCandidate.RequestorInfoID = requestorItem.Value;//Error here
    //newCandidate.RequestorInfoID = (ListItem)RequestorDropDownList.SelectedItem.Value;
    //newCandidate.ReasonID = requestorItem.Value;
    newCandidate.BatchNumber = newBatchNumber;
    newCandidate.EntryStaffUserName = this._loggedInUserName;
    await CandidateCaseController.PostCandidate(newCandidate);
    }

    Z 1 Reply Last reply
    0
    • U User 11369001

      I have a foreach statement. When I run my code in debug mode, I am getting the following error. I am not sure how to fix it. Google search shows may ways of doing it. Error: 'object' does not contain a definition for 'Value' and no accessible method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) My code behind

      foreach(string caseNumber in userEnteredCaseNumberList)
      {
      EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
      newCandidate.CaseNbr = caseNumber;
      newCandidate.RequestorInfoID = requestorItem.Value;//Error here
      //newCandidate.RequestorInfoID = (ListItem)RequestorDropDownList.SelectedItem.Value;
      //newCandidate.ReasonID = requestorItem.Value;
      newCandidate.BatchNumber = newBatchNumber;
      newCandidate.EntryStaffUserName = this._loggedInUserName;
      await CandidateCaseController.PostCandidate(newCandidate);
      }

      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #2

      requestorItem does not have a property named Value. That's all the error is telling you.

      Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups