We have a custom .aspx page that creates a WebPart programmatically, which shows a special view on a library.

XsltListViewWebPart listWp = new XsltListViewWebPart();
listWp.ID = LVWP_GUID;
listWp.ViewGuid = docs.DefaultView.ID.ToString(Views.FORMAT_GUID).ToUpper();
listWp.WebId = SPContext.Current.Web.ID;
listWp.ListId = docs.ID;
listWp.ListName = viewName;
listWp.AllowClose = false;
listWp.AllowConnect = false;
listWp.AllowEdit = false;
listWp.AllowHide = false;
listWp.AllowMinimize = false;
listWp.AllowZoneChange = false;
listWp.ChromeType = PartChromeType.TitleOnly;
listWp.AsyncRefresh = true;
listWp.ManualRefresh = false;
listWp.ParameterBindings += Views.PARAM_BINDING;
listWp.XmlDefinition = [see below]

It uses a view definition like this

    <FieldRef Name="FileLeafRef" ListItemMenu="TRUE" LinkToItem="TRUE" />
    <FieldRef Name="DocumentNumber" ListItemMenu="TRUE" LinkToItem="TRUE" />

The problem is: the links in the dropdown menu are broken, e.g. "Check Out", "Version History", "Edit in undefined" (<- should be Microsoft Word) and "Delete".

The interesting part is that the links for "View/Edit Properties" and "Manage Permissions" work as expected.

Screenshot of working and non-working links

I checked the URLs that are called and it seems that the filename is missing on the links that don't work:

View Properties uses this URL:


But Check Out tries to redirect to this URL:


So it seems that links with an ID work, but links with a filename don't.

Why is this happening and how can I fix it?


I have no idea why, but I figured out that the problem is that the LinkFilename column must be part of the view in order for the file based menu items to work.

As soon as I included

<FieldRef Name="LinkFilename" />

in the view definition, all links work as expected - no matter which column uses LinkToItem or ListMenuItem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.