SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm quite nice to Sharepoint so pardon my lack of knowledge.

In my web part design, I am using this to obtain date and time from the user:

<SharePoint:DateTimeControl ID="interviewSlot" runat="server" />

So I am trying to add the DateTime object from interviewSlot into a particular Item in my "Application" list here:

objJobApplicants = objCurrentWeb.Lists["Application"];
foreach (SPListItem objApplicantItem in objJobApplicants.Items)
     if (objApplicantItem["ApplicantName"].ToString().Equals(applicant))
         objApplicantItem["InterviewTimeslot"] = interviewSlot.SelectedDate;

InterviewTimeslot is a of a Date and Time data type in the list.

The code seems to run fine, however the selected date in the web part is not being added to the Application list. Am I missing some step that is needed specifically for a DateTime object?


share|improve this question
up vote 0 down vote accepted

From what you posted, looks like you need to call Update() on the item:

if (objApplicantItem["ApplicantName"].ToString().Equals(applicant))
    objApplicantItem["InterviewTimeslot"] = interviewSlot.SelectedDate;

SPListItem.Update method

share|improve this answer
THanks this seemed to have worked for me! – lyk Apr 5 '13 at 6:55
If you are new to SharePoint, you should make yourself familiar with the Update() method. Many, many objects in the SharePoint object model have this method, and what it does is write the changes you make to an object into the database so that the changes persist. – Dylan Cristy Apr 5 '13 at 14:08
Noted, thank you very much! :) – lyk Apr 9 '13 at 4:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.