Sharepoint 默认列表项详细信息视图
我有一个 Web 部件,它以指定的格式呈现随机列表项(来自任何列表和列表类型)。 我希望 Web 部件中显示的项目链接到其 ListItem 详细信息视图。 但是,我在列表本身上没有看到任何属性可以告诉我哪个视图是列表的默认详细信息视图(即博客列表详细信息是 Post.aspx)。 这是来自列表定义吗? 我如何以编程方式获取该信息? 我试图避免根据列表类型对任何列表信息进行硬编码。
I have a webpart that renders random list items (from any list and list type) in a specified format. I want the items that are being displayed in the webpart to link to their ListItem detail views. However, I don't see a property on the list itself that would tell me what view is the default DETAIL view for the list (ie. blog list detail is Post.aspx). Does this come from the list definition? How would I get that information programmatically? I'm trying to avoid hard-coding any list information based on list type.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
SPList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url
。我想这就是你要找的。 您需要将 SPListItem.ID 附加到查询字符串上,以便它知道要显示哪个列表项。
将
&Source=/url/to/current/page
附加到查询字符串也是一个好习惯,这样用户在单击取消/关闭按钮时将被重定向回他们离开的页面。编辑或显示表单。Have a look at
SPList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url
.I think this is what you're looking for. You'll need to append the the SPListItem.ID on the querystring so that it knows which list item to display.
It's also a good practice to append
&Source=/url/to/current/page
to the querystring so that users will be redirected back to the page they left when they click the Cancel/Close buttons on the Edit or Display forms.