Domanda

I am getting the following error:

The type or namespace name DateTimeControl does not exist in the namespace Microsoft.SharePoint.WebControls (are you missing an assembly reference?)

**VIEW**
    <tr>
        <td class="auto-style1">StartDate <span class="ms-error">*</span></td>
        <td>
            <spuc:DateTimeControl ID="dtStartdate" runat="server" DateOnly="true" />
        </td>
    </tr>


**C#**

    itemToAdd["StartDate"] = dtStartdate.SelectedDate;

enter image description here

What could be the issue?

È stato utile?

Soluzione

If your solution is sandbox solution then "DateTimeControl" will not support. Because "DateTimeControl" is exist in "Microsoft.SharePoint.WebControls" namespace. And According to microsoft, All of the control classes in the Microsoft.SharePoint.WebControls namespace is not supported in sandbox solution.

Read This

You have two options for make it work,

  1. Use sandbox proxy within your sandbox solution. (Sandbox proxies are components that enable you to make full-trust functionality available to sandboxed solutions)

    OR

  2. Make it farm solution by setting the project's "Sandboxed Solution" property to false.

Source

enter image description here

click on "test" and press F4. it will open property window. there is property named "sandbox solution". set this to false.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top