views:

537

answers:

3

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 trying to get an id for the list item, ideally something like a guid eg

<%# Eval("GUID") %>

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

A: 

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

So try

<%# Eval("UniqueId") %>

Please note the case sensitivity.

Magnus Johansson
The OP is looking for the unique ID of a list item, not a list.
Alex Angas
Oops, corrected.
Magnus Johansson
+1  A: 

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

Rubens Farias
I tried that and heres what i get:System.Web.HttpException: DataBinding: 'Microsoft.SharePoint.WebControls.SPDataSourceViewResultItem' does not contain a property with the name 'UniqueID'.
raklos
@raklos: Try UniqueId (Note the lower case 'd'). See the casing of the link in my answer.
Alex Angas
@Alex: fixed, ty
Rubens Farias
still doesnt work :( .... System.Web.HttpException: DataBinding: 'Microsoft.SharePoint.WebControls.SPDataSourceViewResultItem' does not contain a property with the name 'UniqueId'.
raklos
A: 

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

Alex Angas
but how do i get that using eval?
raklos