HOWTO: Get the field text from a SPFieldChoice

The SPFieldChoice usually holds the Int32 part of a choice field that is comprised of 2 values (the ID of the choice and the text of the field that is displayed).  Take the example of a workflow status column.  The ID 2 corresponds to the field value “In Progress”.  Programmatically, this will yield the value of “2”.

sharePointList[“Workflow Status Field”].ToString();

However, if you wanted to do a comparison against the text “In Progress” (for example to take action in your code against the value of a workflow status) you would have to do this:

string workflowProgressStatus = ((SPFieldChoice)sharePointList.Fields[“Workflow Status Field”]).GetFieldValueAsText(sharePointList[“Workflow Status Field”]);

This would yield the string “In Progress” to the workflowProgressStatus variable.