单击时将复选框值保存到数据库吗?
我在列表中添加了一个复选框,就像人员和组列表中的复选框一样:alt text http://img8.imageshack.us/img8/605/ss20090528093906.png
但是,在我的列表中,我想将所选值保存到数据库。 但我不知道怎么办。 我想我可以将 javascript 添加到 onClick
事件中,但我既不知道将该 javascript 放在哪里(或者我可以使用 C# 代码吗?),也不知道如何从 javascript 更新数据库。
也许你可以帮助我,好吗? 还有哪些其他选择? 我该如何实施呢?
谢谢你!
如果其他人想要添加复选框,则这个文章确实对我有帮助(但不详细)
I added a checkbox to my list, just like there is a checkbox in a People and Groups list:alt text http://img8.imageshack.us/img8/605/ss20090528093906.png
However in my list I want to save the selected value to database. But I have no idea how. I was figuring i could add javascript to onClick
event, but neither I know where do I put that javascript (or can I use C# code?), neither I have an idea how update a database from javascript.
Maybe you could help me, please? What are the other options? And how would I implement one?
Thank you!
In case if someone else wants to add checkbox, then this article did help me (but it is not detailed one)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 jQuery 和 SharePoint Web 服务 - 将单击处理程序附加到复选框并包含从同一行查找项目 ID 的代码 - 很容易在 firebug 中找到。
我的博客上有一些 Web 服务部分的示例代码:
http:// /tqcblog.com/2009/05/04/sharepoint-discussion-with-jquery
Use jQuery and the SharePoint web services - attach a click handler to the checkboxes and include code that finds the item id from the same row - easy enough to locate in firebug.
There's some sample code for the web service part on my blog:
http://tqcblog.com/2009/05/04/sharepoint-discussion-with-jquery
您可以使用 jQuery,使用 jQuery 将单击事件添加到所有复选框,然后让单击事件对您编写并部署到 Sharepoint 的 Web 服务执行 AJAX 调用。 您可以使用内容编辑器 Web 部件在页面中注入 Javascript。 将 Web 服务部署为一项功能。
YOu could use jQuery, add a click event to all checkboxes with jQuery, and have the click event perform an AJAX call to webservice you write and deploy to Sharepoint. You can use the Content Editor Webpart to inject Javascript in the page. Deploy the webservice as a feature.
您可以实现一个 ItemEventReceiver 来为您执行数据库操作并将其附加到您的列表中。 ItemEventReceiver 应监听 ItemAdded、ItemUpdated 和 ItemDeleted 事件,以便您可以对这些不同的情况做出反应并将信息写入数据库。
有关事件接收器的更多信息,您应该查看 Brian Wilson 的关于该主题的博客文章 或 MSDN。
you could implement an ItemEventReceiver that does the database stuff for you and attach it to your list. The ItemEventReceiver should listen onto the ItemAdded, ItemUpdated and ItemDeleted event so you can react on these different situations and write the information into your database.
For more information about event receivers you should have a look at Brian Wilson's blog posts about that topic or at MSDN.