Editing a record, how to? + CrmEntityFormView bug

Sep 8, 2010 at 10:11 AM

Hello everyone,

I guess I'm being thick but I can't find the "edit" counterpart of the CrmEntityFormView. I've seen the examples and I can successfully create a new record; what are my options if I need to edit an existing record?

Do I have to create editing controls manually? I noticed that portals just do that; i.e. in the customer portal,  the Profile.aspx page has a list of textboxes and related validation controls, or EditOpportunity.aspx in the Partner Portal. That is not very straightforward, especially in scenarios where you need to edit many different entities.


In other news, I noticed that Field Names are lost when using the CrmEntityFormView against an organization with a non-english locale. Viewing the source of the page reveals that Labels are rendered, but their text is empty.

Thanks for your time,




Sep 8, 2010 at 3:00 PM

Take a look at the contact us page - it uses the technique you are looking for.

We have not tested the control in a non-english CRM environment.  It looks like you found a bug that we should fix for the next version.

Shan McArthur

Sep 8, 2010 at 9:51 PM

Thank you, Shan.

Sep 9, 2010 at 1:19 PM
Edited Sep 9, 2010 at 1:20 PM

No luck. I just can't find anything related to the modification of existing records via the CrmEntityFormView (and yes, had a look at the Contact page again).

To reiterate:

In CreateContact.aspx (Partner Portal): 

<asp:Panel runat="server" ID="ContactCreatePanel" Visible="false">
<crm:CrmDataSource ID="WebFormDataSource" runat="server" />
		<crm:CrmEntityFormView ID="createContact" runat="server" DataSourceID="WebFormDataSource" EntityName="contact" SavedQueryName="Create Contact Web Form" ValidationGroup="CreateContact" OnItemInserting="OnItemInserting" OnItemInserted="OnItemInserted">
				<div class="actions">
					<asp:Button Text='<%$ Snippet: CreateContact/CreateContact, Create Contact %>' CssClass="button" CausesValidation="true" ValidationGroup="CreateContact" CommandName="Insert" runat="server" />

That's okay, I can create a new Contact, and all is well :) Just like in the Contact page. It's possible to create a new lead. However, in EditContact.aspx (PP):

<asp:Panel runat="server" ID="EditContactPanel">
	<div class="edit-contact insert">
		<asp:ValidationSummary id="valSummary" runat="server" ShowSummary="true" DisplayMode="BulletList" />
		<h3><asp:Label runat="server" ID="actionResultMessage" /></h3>
		<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="FirstName"><crm:Snippet runat="server" SnippetName="EditContact/FirstName" DefaultText="First Name:" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="FirstName" />
		<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="LastName"><crm:Snippet runat="server" SnippetName="EditContact/LastName" DefaultText="Last Name" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="LastName" />
			<asp:RequiredFieldValidator ID="LastNameFieldValidator" runat="server" 
								ErrorMessage="Last Name is a required field" 
								CssClass="validation-message" />
		<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="StreetAddress"><crm:Snippet runat="server" SnippetName="EditContact/StreetAddress" DefaultText="Address 1: Street" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="StreetAddress" />
		<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="City"><crm:Snippet runat="server" SnippetName="EditContact/City" DefaultText="Address 1: City" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="City" />
			<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="State"><crm:Snippet runat="server" SnippetName="EditContact/State" DefaultText="Address 1: State/Prov" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="State" />
			<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="ZipCode"><crm:Snippet runat="server" SnippetName="EditContact/ZipCode" DefaultText="Address 1: Zip/Postal" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="ZipCode" />
			<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="Country"><crm:Snippet runat="server" SnippetName="EditContact/Country" DefaultText="Address 1: Country" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="Country" />
			<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="Phone"><crm:Snippet runat="server" SnippetName="EditContact/Phone" DefaultText="Address 1: Phone" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="Phone" />
		<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="Email"><crm:Snippet runat="server" SnippetName="EditContact/Email" DefaultText="E-mail" /></asp:Label><br />
			<asp:TextBox runat="server" CssClass="text" ID="Email" />
			<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
					ErrorMessage="E-mail must be a valid e-mail address" 
					Display="None" />
		<div class="row">
			<asp:Label runat="server" CssClass="cell-info" AssociatedControlID="Organization"><crm:Snippet runat="server" SnippetName="EditContact/Organization" DefaultText="Organization" /></asp:Label><br />
			<asp:DropDownList runat="server" AppendDataBoundItems="true" ID="Organization">
				<asp:ListItem Text="- Do not associate contact with an account -" Value="" />
		<div class="actions">
				<asp:Button runat="server" CssClass="button" Text="<%$ Snippet: EditContact/UpdateButton, Update%>" OnClick="UpdateButton_Click" />

There's no CrmEntityFormView, only hard-coded controls. Is this by design? Only creation and no editing? Using CRM views to determine which controls to show is pretty powerful, how can it be it is only avaible for record creation?

I know this is taken from the Partner Portal, but this was just an example to clarify my point as I can't seem to find what I'm looking for in either Portal.

Thanks for your time again,


Sep 20, 2010 at 12:03 PM

Any news on when the next SDK version will be released?

Sep 20, 2010 at 3:58 PM

We are targetting around the first week of Oct.