检索 SharePoint 列表数据并将其绑定到下拉列表
我对 SharePoint 相当陌生,因此提前为听起来像“新手”而道歉。
我创建了一个简单的 Web 部件,它使用 Web 用户控件 - [.ascx 文件] 提供该 Web 部件的所有控件。在 .ascx 文件上,有一个 DropDownList,目前是硬编码的,并且在 Web 部件(在 SharePoint 站点内)中运行良好。
但是,我希望 .ascx 文件上的 DropDownList 绑定到 SharePoint 列表的特定列,以便当我更新 SharePoint 列表的该列时,DropDownList 自动反映更新。
请问各位好心人对如何实现这一目标有什么想法吗?
提前非常感谢您,
Ash 8-)
(祝大家新年快乐!)
I'm fairly new to SharePoint so apologies in advance for sounding like a 'Newbie'.
I have created a simple Webpart, which uses a Web User Control - [.ascx file] to provide all the controls for the Webpart. On the .ascx file, there is a DropDownList which is hard-coded at the moment and works well in the Webpart (within a SharePoint site).
However, I want the DropDownList on the .ascx file to be bound to a particular Column of a SharePoint List, so that when I update that column of the SharePoint List, the DropDownList reflects the update automatically.
Do any of you kind folk have any ideas on how to achieve this please?
Thank you very much in advance,
Ash 8-)
(p.s. Happy New Year to you All !)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在发布上述文章(典型)后几分钟内找到了答案。
解决方案是将以下代码放在 .ascx.cs (代码隐藏)文件的 Page_Load 事件中:
我在这里找到了解决方案:
http://blogs .msdn.com/mattlind/archive/2008/02/12/bind-a-asp-dropdownlist-to-a-sharepoint-list.aspx
谢谢,
阿什
I found the answer within minutes of posting the above article (typical).
The solution is to place the following code in the Page_Load event of the .ascx.cs (code-behind) file:
I found the solution here:
http://blogs.msdn.com/mattlind/archive/2008/02/12/bind-a-asp-dropdownlist-to-a-sharepoint-list.aspx
Thanks,
Ash