.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Why is FieldValue and SPContext.Current.Item["DateColumn"] different?

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :SharePoint

I have a custom application page which i am using to format the SPListItem in a particular layout. On this page I am showing a datetime field as:

 <SharePoint:FieldValue runat="server" FieldName="IssueDate" id="FieldValue13"/>

But its showing me -1 day of the original value of IssueDate. So 10/5/2010 shows as 10/4/2010. I have solved this by formatting the value manually :

 <%= SPContext.Current.Item["IssueDate"].ToString() %>   

my question is why would FieldValue show -1 of the original value?

View Complete Post

More Related Resource Links

Get current logon user id with SPContext.Current.Web.CurrentUser.LoginName

Hi all,I've been trying to search for the method to display the currently logon user id. So far, most sites I've visited used SPContext.Current.Web.CurrentUser.LoginName.I've tried this in my SharePoint custom application page. Everything works great.I have a test account, when logged in, was displayed as xxx\testacc.For some reasons, I changed the id in AD to xxx\test and did a full import to MOSS.I logged in to the custom application with the changed id, i.e. xxx\test, BUT the value of SPContext.Current.Web.CurrentUser.LoginName still displayed as xxx\testacc!How do I get the latest id? Has anyone encountered this before?Thank you.Kelvin

Set Field in Current Item to a previous version's field value

When using SPD, can you make a WF condition to set a field's value to it's previous version's value? Versioning is turned on for this doc library, but checkin/checkout is not on. These WF's run only after creation and editing, so I need to set a value back if a user doesn't have permission to set a choice column field to specific values. Thanks in advance, Chris

Problem with Spcontext.current.web.currentuser.name

Hi all, I am using Spcontext in code to retrive the current user login name. But some times Spcontext.current.web.currentuser.name will return name of the user who is currently logged in it is retruning user name other than the current. When I refresh the page two or three times It will return the proper user name. Can anyone help me to resolve this issue.

Excecution of wait for field change in current item action

Hi everybody, I've an SharePoint designer WorkFlow with two simple actions: wait for field change in current item (wait for the aproval status was approved) update item list(set a value to a field in the current item) how immediate is the execution of an workflow like this by the WF Runtime engine?, how it works? would be possible that WF runtime engine take time to execute this tasks, how much is waranteed acording the WF architecture? The Previous question becouse this solution is composed by an smart document and a workflow: -A workflow that have to copy the aproval status  to a field when this was aproved. -The document have to detect the change on the field value(seted by the workflow) when the document is closed by the user(this action could be executed just after the user approve). In conclusion the document depends from the workflow execution to detect the change, if the workflow were not executed "immediately" document actions would not be executed when the document were closed. by the above I need to know how reliable is this workaround and make a choice, this workaround or an event handler controling the itemupdating event(synchronous event) to do the tasks made by the workflow. Suggestions are welcome! PD and Background: The smart document(with managed code) is the template associated to the content type in a document library. The Current

Problems with "Set Field in Current Item" in SP 2007 Workflow

I have created a workflow in spd 2007 that begins by comparing two lists and if the “VendorName” is the same on both lists, I then auto-populating four fields by grabbing the values from another list within same site collection by using the “Set Field in Current Item” action. I have recently discovered that I cannot set additional fields beyond these four fields. I have tried this on two different sites using the same action (i.e. set field in current item) and the result is the same – I cannot add additional actions of this type? To remedy this, I removed duplicate instances of the workflow via List Settings > Workflow Settings > remove dups, but no luck. Problems still persists.   What would be causing this? Has anyone run across this issue? Help!   Thank you in advance.

Set Field in current item

Hi i have created a workflow where the first step is to use the Action Set field in current item. The item is a field called time of status the workflow changes this status from blank to open when a new item is added, the workflow seems to run but just sits in a IN Progress state and does not complete. Does anyone one know of a reason why this would be. Thanks John

Get current list item in ecma script

I have craeted a ribbon button on a "View Form". Now I was trying to retrieve the current list item (On the view form) details using the ECMA script. Once I get the detail i will update few of the field values to the other list. Is it possible to get the current list item details on the List Item - View Form page?

SPContext.Current is null in a WebService in the 12 hive layouts



  I do not understand why I cannot get the SPContext.Current instance.  It must be an IIS Setting because I get it on one machine and not on another, using identical code.

SPContext.Current is null In Custom Membership ValidateUser


Hi,I just get a problem getting SPContext.Current in Custom membership Provider.

We have successfully plugin the custom membership into Sharepoint foundation 2010. We tried to programmically update the user's full name after user logs in and it failed in 2010 version. (good in 2007)

This is the simplified code. The class is a custom membership provider.Strangely, this only happens in 2010 version and never raised a problem in 2007.

public override bool ValidateUser(string username, string password)
   bool isvalid = false;

    if(username=="admin" && password="pwd")
      isvalid = true;
     var webContext = SPContext.Current.Web; //this returns null

   catch (System.Web.Services.Protocols.SoapException exp)
    Logger.WriteLog(exp.InnerException.ToString(), "wss login error");
   return isvalid;


Please Help. Thank you.



SPContext.Current.Web is not latest


I am creating a list with a deployed list template. with the following code:

SPSite site = new SPSite("http://servername");
SPWeb web = site.OpenWeb();

.Lists.Add(listName, listName, listTemplate);
SPList List = Web.Lists[listName]

HTTP Module :Item.Update() gives exception 'Operation is not valid due to the current state of the


Hi, I have created a http module to update the list item but when i use the Update function of SPListItem object it gives the error: "Operation is not valid due to the current state of the object". Below is the HTTP Module i have written to update the List Item. Please suggest






public class SiteUsage : IHttpModule



SPD 2010 reusable workflow not picking up Current Item values


Hi, I have created an SPD 2010 reusable workflow that is attached to a specific content type...such content type is derived from a published InfoPath form with some of its fields being promoted, like the "Approvers" fields.

In SPD 2010, I add the " Start Approval process on Current Item with 'Participants' " action...those Participants I get (or at least I want to) from the Current Item: ApproversField.

After saving and publishing the workflow, I use the content type (set as default) in a form library and then add the workflow to it. After creating an Item the workflow is automatically rejected.

I checked the Workflow History and I realized the participants are not being picked from the current item's field... weird thing is, if I try the very same actions/etc in a workflow that is attached to that list everything works perfect... I tried to log messages all around the workflow process but the values never get picked up...

What am I missing here?

Thanks in advance.

difference between Set Field in Current Item versus Update List Item?

Is there a technical different between Set Field in Current Item and  Update List Item if the field in the item being updated with in the same list the workflow is attached to?  It seems like there wouldn't be any difference - that you could use one or the other.  But I'm having trouble with my workflow.  It completes without error, but the field in my current list item isn't being updated (getting the value from another list in same site).
There are no mistakes; every result tells you something of value about what your are trying to accomplish.

SPContext.Current.Web.CurrentUser is null


I am using FBA in an internet zone of sharepoint site.

I am getting null in Current.Web.CurrentUser object even when i am logged in as FBA User. The welcome message is shown on top to ensure that FBA is working, but CurrentUser is giving null.

The same code works perfectly when logged in as Domain user in Intranet Zone.


SPContext.Current.Web.CurrentUser null in application page on 2008 r2 server

With my current situation I have:
a wss3 development environment on a 2003 R2 server
then a production 2008 r2 server.

For some reason on the 2008 server the SPContext.Current.Web.CurrentUser object is null for users who are site collection administrators but may not have permission to log into the server itself; however, on the 2003 R2 server the code works fine for those users.
When googling around, I had seen something about nt permissions on the bin folder sometimes being and issue until asp.net cache picks up the dll but this is a page in the _layouts directory and the code is in the .aspx page itself. It works fine for me as a system administrator on either machine.

Any suggestions? Thanks.

SPContext.Current returns a null


ok, I am new to the wonder world of WSS and Sharepoint.   The objective of my code is to upload a file into a particular folder into a document library.   Well, I was able accomplish this task ( ONCE ) on a Virtual machine but something happened somewhere and the code below no longer works:


public string UploadFile(string folderName, string fileName, byte[] contents)

{            String retVal = "File : " + fileName + " Upload Successfull.";


SPContext.Current.Web.CurrentUser returns inconsistent username (With different characters)



We are using MOSS 2007 with browser enabled Infopath forms. We have a user with username "DOMAINNAME\fakgul" (Active Directory also displays the user as this). However when the user opens an Infopath form  the code line behind the form below:

SPUser openedByUser = SPContext.Current.Web.CurrentUser;

returns "DOMAINNAME\fakgül" (with "U-umlaut"). When we enter the "User information" page of that user, "Account" field also displays as "DOMAINNAME\fakgül" (with "U-umlaut").

What is more strange is this is not the consist

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend