none
External List/BDC tutorial results in "Unable to display this web part" error

    Question

  • I've been following along with this tutorial.

    I know everything is set up properly because when I step through the code, I get results from the Linq queries. I've limited the results to 20 to test my code.

    The problem is when I debug, the page always says "Unable to display this web part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator."

    The error has a GUID below it, that I've searched in the SharePoint logs for. The logs have a warning about the default filtering could lead to performance issues, but I don't see how that could be the problem. I've even limited my result set to 1 item, and I get the same error.

    Any thoughts on how to correct this?

    Edit

    I've noticed these lines in the event viewer. I thought it had something to do with the throttle settings on the machine I'm working on (a local site), but I've adjusted the throttle settings but I'm still getting the same error.

    External Lists: Using the default Filter settings for Finder 'ReadItem'in Entity 'Employee' of EntityNamespace 'EmployeeData.EmployeeData'. This will likely result in significant performance degradation.  Stack trace    at Microsoft.SharePoint.SPListDataSource.GetEntityInstanceEnumerator(XmlNode xnMethodAndFilters)     at Microsoft.SharePoint.SPListDataSource.GetFilteredEntityInstancesInternal(XmlDocument xdQueryView, Boolean fFormatDates, Boolean fUTCToLocal, String firstRowId, Boolean fBackwardsPaging, String& bdcidFirstRow, String& bdcidNextPageRow, List`1& lstColumnNames, Dictionary`2& dictColumnsUsed, List`1& mapRowOrdering, List`1& lstEntityData)     at Microsoft.SharePoint.SPListDataSource.GetFilteredEntityInstances(XmlDocument xdQueryView, Boolean fFormatDates, Boolean fUTCToLocal,... e87f6870-aeed-4688-bf58-400a3b0fd794
    09/26/2012 10:05:15.82* w3wp.exe (0x1ABC)                        0x0424 SharePoint Foundation          General                        99a4 High     ... String firstRowId, Boolean fBackwardsPaging, String& bdcidFirstRow, String& bdcidNextPageRow, List`1& lstColumnNames, Dictionary`2& dictColumnsUsed, List`1& mapRowOrdering, List`1& lstEntityData)     at Microsoft.SharePoint.SPListItemCollection.EnsureEntityDataViewAndOrdering(String& bdcidFirstRow, String& bdcidNextPageFirstRow)     at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()     at Microsoft.SharePoint.SPListItemCollection.get_Count()     at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)     at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigato... e87f6870-aeed-4688-bf58-400a3b0fd794
    09/26/2012 10:05:15.82* w3wp.exe (0x1ABC)                        0x0424 SharePoint Foundation          General                        99a4 High     ...rInternal()     at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PerformSelect()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.DataBind()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.EnsureDataBound()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls()     at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.CreateChildControls()     at Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetCallbackResult()     a... e87f6870-aeed-4688-bf58-400a3b0fd794
    09/26/2012 10:05:15.82* w3wp.exe (0x1ABC)                        0x0424 SharePoint Foundation          General                        99a4 High     ...t Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.GetCallbackResult()     at System.Web.UI.Page.RenderCallback()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at ASP.VIEWPAGE_ASPX__1081523282.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\fc7c607e\61b47321\App_Web_viewpage.aspx_-1081523282.kdnnjrzz.0.cs:line 0     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()... e87f6870-aeed-4688-bf58-400a3b0fd794
    09/26/2012 10:05:15.82* w3wp.exe (0x1ABC)                        0x0424 SharePoint Foundation          General                        99a4 High     ...     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr ma... e87f6870-aeed-4688-bf58-400a3b0fd794
    09/26/2012 10:05:15.82* w3wp.exe (0x1ABC)                        0x0424 SharePoint Foundation          General                        99a4 High     ...nagedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)   e87f6870-aeed-4688-bf58-400a3b0fd794

    • Edited by TimM03054 Wednesday, September 26, 2012 2:16 PM Added log data
    Wednesday, September 26, 2012 12:32 PM

Answers

  • Hi Tim,

    I have always believed that the more mistakes you make, the more you learn :-)

    There were a couple of mistakes you made when you tried to change the data type of the Return parameters for your Read List method. I think i did not explain myself properly in my last message. Only the first type descriptor (named EmployeeList) should have been changed to IEnumerable<T>. The inner type descriptor (named Employee) is supposed to describe the type of each item in the collection and hence it should have just been vwCurrentEmployee and not IEnumerable<vwCurrentEmployee>. Then the next Type Descriptor (named EMPLOYEE_NUMBER) is supposed to describe the property(ies) within the vwCurrentEmployee type. Hence it's data type should have simply been String and not IEnumerable<String>. 

    I have made all these corrections in the code and this time tested it in my environment to ensure that you don't have to bang your head once again :-)

    I have uploaded the modified source code here.


    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    • Marked as answer by TimM03054 Friday, September 28, 2012 2:36 PM
    Friday, September 28, 2012 2:14 PM

All replies

  • The error could be caused by a spelling mistake. For example, your table may be returning a column named EmailAddress and mis-spelled it as Emailaddress in your BDC Model (steps 6-10 in the tutorial). 

    Also you could have created a mis-match in the data types that are being returned as well. For example, the data type of EmailPromotion should be Int32, but in the TypeDescriptor you may have left it as String.



    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Wednesday, September 26, 2012 2:57 PM
  • Thanks for the pointer, Nauzad. I've recreated the project and tried only returning one field (which I know is spelled correctly) - still no luck. I get the same error message.

    I also tried creating a new project and pulling in a different table, but I still get the same error message about the web part not being able to be displayed.

    Wednesday, September 26, 2012 6:18 PM
  • Can you upload your solution to skydrive or something similar so that i can download it and take a look?

    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Thursday, September 27, 2012 5:37 AM
  • Set a breakpoint in your Finder method, click F5 in Visual Studio and create an External List on the loaded page. Will you reach the breakpoint? If yes, please find the line in the code which rises an exception.

    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts | Lightning Tools Blog

    Thursday, September 27, 2012 6:59 AM
  • Hi Dmitry,I can set a breakpoint and see data returned by my Linq query. The code doesn't throw any exceptions.

    Thursday, September 27, 2012 12:09 PM
  • I've got the code on my SkyDrive site - how can I get a link to you? (I've never shared anything on SkyDrive before)
    Thursday, September 27, 2012 12:18 PM
  • I've got the code on my SkyDrive site - how can I get a link to you? (I've never shared anything on SkyDrive before)
    click on the "Share Folder" link on the top bar and then "Get a link".

    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Thursday, September 27, 2012 1:47 PM
  • http://sdrv.ms/QeYkvl

    Here you go. I've changed the server, username and password in my connection string so I could publish this.

    Thursday, September 27, 2012 2:23 PM
  • OK, the weird thing is I downloaded a trial of LightningTools BCS Metaman, and walked through their tutorial...and the code MetaMan generates works fine.

    I guess if we have to drop the money on the license to get this working, we have to drop the money...but it seems like a lot when all we want to do is connect to one view and pull the data in from it.

    Thursday, September 27, 2012 2:49 PM
  • Hi 

    I downloaded your project and i saw the mistake right away. 

    IEnumerable<vwCurrentEmployee> emps =
                    from employees in dc.vwCurrentEmployees.Take(20)
                    select employees;

    Without any projected columns, your select clause is returning all the columns in the Employees table. However in the BDC Model file, you have specified only one column. Thus there is a mismatch in what your code is returning versus what SharePoint is expecting. 

    To start off, delete all except a couple of columns from your dbml file, and then make sure that in the BDCM file, u mention all those columns with the correct case sensitive name and data type.



    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Thursday, September 27, 2012 3:10 PM
  • OK, I've deleted all but one column in my DBML file, and match the name, datatype and case in the BDCM file. I'm still throwing the same error.
    Thursday, September 27, 2012 4:16 PM
  • There must be some other things missed out. Have you uploaded the latest project to skydrive?

    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Thursday, September 27, 2012 4:34 PM
  • I noticed another error in your code. According to your BDCM file, the return type of your ReadItem method is a String. However the correct return type (according to your code) is actually a vwCurrentEmployee object.

    Same with the ReadList method. The return type in your BDCM file is IEnumerable<String>, however the actual return type is IEnumerable<vwCurrentEmployee>

    In case you still face more errors, please upload your latest project to skydrive and share the link


    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Thursday, September 27, 2012 4:39 PM
  • Latest project:

    http://sdrv.ms/PIrWmz

    Thursday, September 27, 2012 4:41 PM
  • Your latest project file doesn't contain the corrections i last suggested for the data types of the return parameters

    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Friday, September 28, 2012 6:22 AM
  • Open your .bdcm file. Using the BDC Explorer window, expand your ReadItem method and come to the TypeDescriptor of the Return Parameter (named Employee in your case). Using the Properties window, change it's Type Name property to the correct type (vwCurrentEmployee in your case).

    Do the same thing for the ReadList method. Go to the Return Parameter and this time make sure that the "Is Enumerable" checkbox is enabled, because this method returns a collection of vwCurrentEmployee objects. Repeat the same step for the inner Type Descriptor as well. Change it's Type Name to vwCurrentEmployee.


    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Friday, September 28, 2012 12:31 PM
  • Nauzad,

    Let me begin by saying thank you for all the help so far.

    I've followed your instructions but I'm still getting the "Web part could not be displayed" error message.

    What am I missing here? I don't think it should be this difficult to pull one field in.


    New code
    • Edited by TimM03054 Friday, September 28, 2012 1:14 PM
    Friday, September 28, 2012 1:14 PM
  • Hi Tim,

    I have always believed that the more mistakes you make, the more you learn :-)

    There were a couple of mistakes you made when you tried to change the data type of the Return parameters for your Read List method. I think i did not explain myself properly in my last message. Only the first type descriptor (named EmployeeList) should have been changed to IEnumerable<T>. The inner type descriptor (named Employee) is supposed to describe the type of each item in the collection and hence it should have just been vwCurrentEmployee and not IEnumerable<vwCurrentEmployee>. Then the next Type Descriptor (named EMPLOYEE_NUMBER) is supposed to describe the property(ies) within the vwCurrentEmployee type. Hence it's data type should have simply been String and not IEnumerable<String>. 

    I have made all these corrections in the code and this time tested it in my environment to ensure that you don't have to bang your head once again :-)

    I have uploaded the modified source code here.


    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    • Marked as answer by TimM03054 Friday, September 28, 2012 2:36 PM
    Friday, September 28, 2012 2:14 PM
  • Nauzad,

    Thanks for the help with this! I got it working...I'm looking through the code and trying to figure out where I went wrong. (That tutorial could use some clarification - I never would have figured that out on my own)

    Best,

    Tim

    Friday, September 28, 2012 2:38 PM
  • Nauzad,

    OK, this is working with one field...any advice on adding other fields to the results? When I try I wind up throwing the error again - if I back out and go back to just employee number, it works fine.

    I tried recreating my view object, deleting the fields I didn't need, and set everything up to match the EMPLOYEE_NUMBER field. No dice.

    Thanks again!

    Tim

    Friday, September 28, 2012 3:09 PM
  • Ok, Lets go thru the steps.

    1. Update your model (.dbml file). Lets say that now in addition to the EMPLOYEE_NUMBER field, we have an additional nvarchar field named EMPLOYEE_NAME.

    2. You don't need to change anything in your EmployeeService.cs file

    3. Open your .bdcm file. Use the BDC Explorer and expand your ReadItem method.

    4. Go to the Type Descriptor of the Return Parameter and add one more child type descriptor to it to describe the EMPLOYEE_NAME property.

    5. Now, expand the ReadList method, Once again go to the Type Descriptor named Employee and add the same child type descriptor to it as well.

    That's it. Delete the old list, create a new one and you should be in business.


    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

    Friday, September 28, 2012 3:54 PM
  • Nauzad,

    Thank you so much! It's working now and I can add new fields to the list. (I wish the tutorials mentioned deleting the old list so you can see your changes!)

    Friday, September 28, 2012 4:47 PM