As stated on MSDN, the CHOICE element contains the value within its body.

That means that in a field, if I have:


the HTML output is:

<option value="foo">foo</option>
<option value="bar">bar</option>

This is a problem for me as I need the value to be different than the label. What I need is this:

<option value="CODE1">foo</option>
<option value="CODE2">bar</option>

I also tried this:

    <CHOICE Value="CODE1">foo</CHOICE>
    <CHOICE Value="CODE2">bar</CHOICE>

But the result is still this:

<option value="foo">foo</option>
<option value="bar">bar</option>

Is there a way to specify different value than the label in a field of type Choice?

  • Just as a reference. Your question seems to be somewhat related to mine here. Fell free to have a look, but be aware that I haven't still been able to make that caml property do anything usefull.. Commented Jan 16, 2012 at 8:36

3 Answers 3


SPFieldChoice has a property named FieldRenderingControl. Using reflector you can find this code in the FieldRedneringControl property:

switch (this.EditFormat)
    case SPChoiceFormatType.Dropdown:
        control = new DropDownChoiceField();

    case SPChoiceFormatType.RadioButtons:
        control = new RadioButtonChoiceField();

        return null;

It seems that DropDownChoiceField is our control. Navigate to this control and in CreateChildControls you can see:

this.m_dropList.DataSource = this.DataSource;
this.m_dropList.DataValueField = "ValueField";
this.m_dropList.DataTextField = "TextField";

..lets go to DataSource property:

    DataTable table = new DataTable();
    table.Locale = CultureInfo.InvariantCulture;
    table.Columns.Add(new DataColumn("ValueField", typeof(string)));
    table.Columns.Add(new DataColumn("TextField", typeof(string)));
    if (string.IsNullOrEmpty((string) this.ItemFieldValue))
        DataRow row = table.NewRow();
        row[0] = string.Empty;
        row[1] = string.Empty;
        this.m_bHasBlankChoice = true;
    for (int i = 0; i < base.NumberOfChoices; i++)
        DataRow row2 = table.NewRow();
        row2[0] = ((SPFieldChoice) base.Field).Choices[i];
        row2[1] = row2[0];
    this.m_dataSource = new DataView(table);
return this.m_dataSource;

row2[1] = row2[0] means that value attribute always equals to option's label and your experiments prove it (my answer is related to 2010 sharepoint)

If this behavior extremely needed, may be custom field type will be an option or any workarounds.

  • Thanks for the inside view :). I changed my application to use the label instead of values. It sucks but that's life...
    – JohnDoDo
    Commented Jan 23, 2012 at 15:01

There is an explanation how to fix your problem, but I'm not sure that this solution is good, because you should change sharepoint fiels. I think that the best way is to change logic of your application.


Short answer: No.

The only (out of the box) ways to do this are:

  • Lookup field

    • (PRO: behaves as a choice field when rendered)
    • (CON: only works within 1 site only)
  • Managed metadata, adding the value as a synonym

    • (PRO: works everywhere)
    • (CON: is type ahead, so looks different from choice field)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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