是否可以在 onet.xml 中分配 webpart id?
我制作了一个包含三个区域的页面。在 onet.xml 中,我定义了三个 Web 部件,这些部件将在创建站点时添加到页面中。是否可以为 onet.xml 中的每个 Web 部件分配一个 id,或者我是否需要编写一个连接连接的功能接收器?
我最初的想法是在页面本身上使用,但后来我需要 web 部件的 id。
I've made a page with with three zones. In onet.xml I have defined three webparts which will be added to the page upon site creation. Is it possible to assign an id to each webpart in onet.xml, or do I need to write a feature receiver which hooks up the connections?
My initial thought was to use on the page itself, but then I need the id's of the webparts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您查看上面的代码片段,所有属性都在 Properties 标记中定义,您是否尝试向其中添加 ID ,我猜它应该可以工作。
If you look at the above snippet all the Property are defined in the Properties tag, have you tried to add a ID to it , My guess is it should work.
我找到了两个解决方案。一种是将 Web 部件添加到页面布局中,但不在区域中。然后你可以使用 id 将它们连接起来。
但我寻求的解决方案是在我的一个 Web 部件中创建一个“InitConnection”函数,该函数在第一次运行时连接页面上的所有其他 Web 部件。
我认为可以对功能装订执行相同的操作,但我采用的解决方案很简单且代码很少。
I've found two solutions. One is to add the webparts to a page layout, but not in zones. then you can use the id's to hook them up.
But the solution I went for was to create a "InitConnection" function in one of my webparts which hooks up all the other webparts on the page the first time it's run.
I think it would be possible to do the same with feature stapling, but the solution I went for was easy and little code.