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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:36:50+00:00 2026-06-05T16:36:50+00:00

This is a code fragment from my controller [HttpPost] public ActionResult Cancel(string id,FormCollection collection)

  • 0

This is a code fragment from my controller

[HttpPost]
public ActionResult Cancel(string id,FormCollection collection)
{
   //This is how I would like to declare appt but I cannot seem to correctly pass id into this method
   //var appt = Application.Session.GetObjectFromOid<Appointment>(new ObjectId(id));

   //I am trying to do it this way instead but I get an error
   var appt = (Appointment)Application.Appointments.Where(a=>a.Id.Equals(collection["Id"]));
   .....
}

This is the error that I get:Unable to cast object of type ‘WhereListIterator`1[Web.Model.Appointment]’ to type ‘Web.Model.Appointment’.

This is my view:

<input type="button" value="Save" onclick="updateCancel(); return false;" /><button>Save</button>

and this is my function

 function updateCancel() {
    $('#cancel').ajaxSubmit({

    });
    }

So why am I getting this error?
OR is there a way to pass Model.Data.Id into my function so that I can just use id instead?

  • 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-05T16:36:51+00:00Added an answer on June 5, 2026 at 4:36 pm

    This is what I ended up using and it worked.

    var appt = Application.Session.GetObjectFromOid<Appointment>(new ObjectId(id));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A typical code fragment obtained from the YouTube embed feature looks like this: <object
Can someone dumb it down and explain, how this code fragment from a previous
In this code fragment, which constructor is actually called? Vector v = getVector(); Vector
When I run this code fragment, neither side is taken. if (Boolean.class.isAssignableFrom(boolean.class)) { uLog.error(Boolean
For the following code fragment. /*This program demonstartes how a virtual table pointer *
This is the fragment of code inserted with ajax: <form> <label for = task-name>Name</label>
While porting over a code fragment from python I've stumbled over a trivial problem:
In this code fragment foreach (var row in grid.Rows) { } the type of
I'm currently using this code fragment to retrieve the one xml value that will
The following code fragment does nothing, but illustrates the problem. It was extracted from

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.