Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the URL of the specified list view in a mobile Web application.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
Public Shared Function GetViewUrl ( _
list As SPList, _
view As SPView _
) As String
'Usage
Dim list As SPList
Dim view As SPView
Dim returnValue As String
returnValue = SPMobileUtility.GetViewUrl(list, _
view)
public static string GetViewUrl(
SPList list,
SPView view
)
Parameters
list
Type: Microsoft.SharePoint.SPListAn SPList object that represents a list on a site.
view
Type: Microsoft.SharePoint.SPViewAn SPView object that represents a view of the data that is contained in the list.
Return Value
Type: System.String
A string that contains the URL.
Examples
The follow code shows GetViewUrl() used to set the href property of a Link control. For the full context of the example, see How to: Create a Mobile Adapter.
protected override void CreateControlsForDetailView()
{
Image iconImage = this.CreateWebPartIcon(WebPartIconLink.LinkToDetailView);
iconImage.BreakAfter = false;
this.Controls.Add(iconImage);
Label titleLabel = this.CreateWebPartLabel();
this.Controls.Add(titleLabel);
Int16 itemCount = 1;
foreach (SPListItem item in this.CurrentListItems)
{
SPMobileTemplateContainer container =
new SPMobileTemplateContainer { List = this.CurrentList, View = this.CurrentView, Item = item};
ITemplate template = SPControlTemplateManager.GetTemplateByName("MobileSimpleViewListItemIterator");
template.InstantiateIn(container);
this.Controls.Add(container);
// Start new line.
this.Controls.Add(new LiteralText());
if (itemCount++ >= 3)
{
Link moreItemLink = new Link
{ Text = "more",
href = SPMobileUtility. GetViewUrl(this.CurrentList, this.CurrentView) };
this.Controls.Add(moreItemLink);
break;
} // end if limit has been reached
}// end for each item
}