开发者

get a guid of an list item of a sharepoint list

Im using SPDataSource to bind a sharepoint list to a repeater control

within the itemtemplate of the repeater i am using things such as

<%# Eval("Title") %>

im 开发者_JAVA技巧trying to get an id for the list item, ideally something like a guid eg

but the above does not work... how can i get a guid? btw i did <%# Eval("ID") %> this worked however it returns a number e.g 1, 2, 3..

ideally i want something more like a guid.

thanks


Ugly, but works

<%# ((SPListItem)((SPDataSourceViewResultItem)Container.DataItem).ResultItem).UniqueId %>

Don't forget to add

<%@ Import Namespace="Microsoft.SharePoint" %>   
<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 

Simple way

<%# Eval("UniqueId") %>

works only if you set IncludeHidden to true on your SPDataSource


The SPListItem property UniqueId is the unique identifier for the item.

So try

<%# Eval("UniqueId") %>

Please note the case sensitivity.


Try <%# Eval("UniqueId") %>


The GUID for a list item is stored in SPListItem.UniqueId.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜