开发者

Getting List Item URL in Sharepoint 2007

开发者 https://www.devze.com 2022-12-11 10:22 出处:网络
I\'m creating a webpart that aggregates a load of content from different lists thr开发者_StackOverflow中文版oughout our site collection what I can\'t workout is how to get the exact link to each item.

I'm creating a webpart that aggregates a load of content from different lists thr开发者_StackOverflow中文版oughout our site collection what I can't workout is how to get the exact link to each item. All I seem to get back is {site}/{listtitle}/1.000 how do I get this "1.000" to say "pagename.aspx?id=1", is this something I have to work out myself or is there a function to do this?


How I do it:

string itemUrl = List.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl + "?id=" + item.ID;


To get the ID of an item in a list you can use SPListItem.ID. Then you can just append it to the base URL that you want, e.g. "pagename.aspx?id=" + myitem.ID.

0

精彩评论

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