Friday, December 23, 2011

Trouble shot Edit Item Issue in External List

i create a external List with External Content Type, and this content type is built with Business Model from VS2010.

I successfully launch this external list and try to view each individual item. then the dialog window display the following error message.

"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.


Correlation ID:d71cdf7f-1cdc-4dae-b78f-42e2e3c31a8b"


based on the above error message, we only know that web part is failed to display the content. we only perform some investigation to see what is root cause.

as i mentioned in my previous post Trouble shooting sharepoint 2010 with Correlation ID 

since there is a Corrleation ID shown in the error message. then we can use to seek more specific informations about the error followed the post we can get the detail error message from the Log file in the Sharepoint LOGS folder.

"getInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Sequence contains no elements     at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)     at ProductModel.BdcModel1.ProductService.ReadItem(String id)     --- End of inner exception stack trace ---     at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAt...    18c78309-5e2d-413c-9e84-3673bebd1053
    ...tr, Binder binder, Object[] parameters, CultureInfo culture)     at Microsoft.SharePoint.BusinessData.SystemSpecific.DotNetAssembly.DotNetAssemblySystemUtility.Execute(Object[] args)    18c78309-5e2d-413c-9e84-3673bebd1053
    Inner exception 2: System.InvalidOperationException: Sequence contains no elements     at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)     at ProductModel.BdcModel1.ProductService.ReadItem(String id)    18c78309-5e2d-413c-9e84-3673bebd1053"

I am easily figure out that there is a bug within the ReadItem Method, the exception is thrown when
to First Method of Enumeralb Object.

Tuesday, December 6, 2011

How to use Javascript to enable automatically login in Look Server 9.0

I had posted an article for using the javascript within master page in asp.net 4.0.
you can view it here http://dandeng.blogspot.com/2011/09/calling-javascript-function-in-aspnet.html

in the artilce i have shown you how to use javascript to fill the user name and password field in the login page. however i still encouter a new issue. the button event never got fired as a result the login page can't be redirect. i use the firebug to step through the javascript code. the button click event did trigger however. the form never had been submit.

the root cause of this issue is the button click event had been handled by another javascript function
ActionOnClick

<button style="vertical-align:top;text-align:center;overflow:hidden;padding:0px;width:65px;height:21px;" onmousedown="childNodes[0].src='Sci_images/Loginbt.jpg';PushButtonPicAlign(this,4,0,100,'MainContent_TopScreen__nlctl111_Image');PushButtonOffsetImage(this,1);" type="button" onfocus="GotFocus(&quot;MainContent_TopScreen__nlctl111&quot;);" onblur="LostFocus();" onclick="ActionOnClick(&quot;MainContent_TopScreen__nlctl111&quot;);" onmouseover="childNodes[0].src='Sci_images/Loginbt.jpg';PushButtonPicAlign(this,4,0,100,'MainContent_TopScreen__nlctl111_Image');" onmouseup="childNodes[0].src='Sci_images/Loginbt.jpg';PushButtonPicAlign(this,4,0,100,'MainContent_TopScreen__nlctl111_Image');PushButtonOffsetImage(this,0);" onmouseout="childNodes[0].src='Sci_images/Loginbt.jpg';PushButtonPicAlign(this,4,0,100,'MainContent_TopScreen__nlctl111_Image');PushButtonOffsetImage(this,0);" tabindex="6" id="MainContent_TopScreen__nlctl111"><img style="left: -4px; top: 0px; position: absolute; clip: rect(auto, 68px, auto, 5px);" src="Sci_images/Loginbt.jpg" onload="ImagePicSaveOrigSize(document.getElementById('MainContent_TopScreen__nlctl111_Image'));PushButtonPicAlign(document.getElementById('MainContent_TopScreen__nlctl111'),4,0,100,'MainContent_TopScreen__nlctl111_Image');" id="MainContent_TopScreen__nlctl111_Image" lowsrc="72,21"><span style="font-size: 8pt; vertical-align: top; left: 0px; top: 0px;"></span></button>

the solution is simple and straight you can just call this function within your custom function. then the button click will be triggered and page will be reload and redirect.

put the following code snippet into your own javascript function.

ActionOnClick("BUTTON_ID");

then the auto login will work properly.

Friday, December 2, 2011

Sharepoint Content Query Error:"One or more field types are not installed properly."

when i contruct a content query with a custom web part to filter the content based on the dropdownlist selection. i compile without any error, then i successfully deployed it to the test server.

After i added this webpart to the page, there is a warming message was shown on the top of the web part.

"One or more field types are not installed properly. Go to the list settings page to delete these fields. "

after i google for a bit, and know that sharepoint server complaint about the field did not match any columns in the list.

"<Where><Leq><FieldRef Name=\"Customer_x0020_ID\" /><Value Type=\"DateTime\">{0}</Value></Leq></Where>

the root cause is that the display name is Customer ID shown in the list view.  i think that Customer ID should be the field name that i can use to contruct the query. however, when i view the page source and found that the Internal name of Customer ID is CustomerID without the space.

here is the recontruct query that work with any warming message.

"<Where><Leq><FieldRef Name=\"CustomerID\" /><Value Type=\"DateTime\">{0}</Value></Leq></Where>

please do not delete or remove any column from the list/ library settings, the query complaint about the column is not found, because it verify only by the internal name, not the diplay name shown in the list view. 

the correct solution is click on link of library / list to view the library/list, then right click the page to select view page source to find internal name of fields that you will include in your content query. 

Thursday, December 1, 2011

Enable Developer Performance Dashboard in Sharepoint 2010

when I developed a ListEvent in the Custom List. but i really want to know how is the event feature perform

in shaepoint 2010.

here is a line you can execute in the sharepoint 2010 server via CMD

"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\stsadm.exe" -o setproperty -pn developer-dashboard -pv OnDemand

then restart the iis to allow the sharepoint to enable this feature.

after you click on the library, you can see a ICON in the top righ corner. when you cllick on the icon.
the dashboard will be shown in the button of the page with all performance information. those detail
 information will be great helpful for trouble shooting when you encounter performance related issue.