Dynamics CRM 2011 Portal Development – CrmEntityDataSource

Dynamics CRM 2011 Portal Development

CrmEntityDataSource data source control expose a property “DataItem” of type object and make it available for other controls to bind to, without requiring code. It only supports retrieving value from CrmEntityDataSource.DataItem property.

If CrmSiteMapNode is assigned as the value for DataItem property, then the return value will be
new Entity[] { CrmSiteMapNode.Entity },
otherwise it will be
new object[] { CrmEntityDataSource.DataItem }.

DataItem property can be set in the .aspx markup by using ASP.NET Expressions/ExpressionBuilder (e.g. CrmSiteMap Expression).

More information regarding to ASP.NET expression can be found ASP.NET Expressions Overview  and ExpressionBuilder Class.

DataItem property can also be set in the .cs code behind.

Example:


<crm:CrmEntityDataSource ID="CrmEntityDataSource1" runat="server" DataItem='<%$ CrmSiteMap: Current %>'>
 </crm:CrmEntityDataSource>
 <asp:GridView ID="GridView1" runat="server" DataSourceID="CrmEntityDataSource1">
 </asp:GridView>

Result:

Advertisements

2 comments on “Dynamics CRM 2011 Portal Development – CrmEntityDataSource

  1. Pingback: Dynamics CRM 2011 Portal Development | Zhongchen Zhou's Blog

  2. Pingback: Dynamics CRM 2011 Portal Development - Zhongchen Zhou's Dynamics CRM Tips, Tricks and Portal Development - CRM Technical Blogs - Microsoft Dynamics Community

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s