MOSS 2007 - 使用可连接的 WebPart - 消费者有 TextBox

发布于 2024-08-06 21:41:17 字数 416 浏览 1 评论 0原文

我有 2 个已连接的 Web 部件,其中提供者向消费者发送一个字符串。

但是,如果我将任何 TextBox 控件放入消费者 Web 部件中,它就无法工作。 (如果我使用标签或文字控件,效果很好。

这个想法是使用者由文本框之类的表单控件组成。

例如 http://www.codeproject.com/KB/sharepoint/ConnectingCustomWebParts.aspx

工作正常...直到您用 TextBox 替换消费者 Label 控件。

非常感谢任何帮助。

I have 2 webparts which are connected, where the provider sends a string to the consumer.

However it fails to work if I put any TextBox controls in the consumer webpart. (works fine if I use a Label or Literal control.

The idea is that the consumer is to be composed of form controls like TextBoxes.

e.g. the codeproject sample at http://www.codeproject.com/KB/sharepoint/ConnectingCustomWebParts.aspx

Works fine... until you replace the consumer Label control with a TextBox.

Any help gratefully received.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷鸟归林 2024-08-13 21:41:17

好吧,如果这仍然需要答案......

为什么它可以与一个控件一起使用而不是另一个控件,我不确定。我无法让它按照该示例中的编码一致工作的原因是 本文中提出的问题。 数据并不总是存在于 Web 部件生命周期的创建控件部分中。我有更好的运气来获取数据并将其放置在 ConnectionConsumer 事件期间的会话或视图状态中的某个位置,然后将值设置为需要在 OnPreRender 事件中显示它的控件,或者只是以某种方式绑定到该控件,例如在网格中,仅在 OnPreRender 中用作数据源的列表上调用刷新,在创建控件中调用刷新并不能可靠地工作,仅在 OnPreRender 中。

一旦我真正理解了 Web 部件生命周期,事情对我来说就变得简单多了,并最终告诉我为什么在 Java Portlet 中,它们采用 post/redirect/get 循环来尝试避免页面上各个 Portlet 之间的这种非常精细的协调。

Well, if this still needs an answer....

Why it would work with one control and not another, I'm not sure. The reason I couldn't get it to work consistently as is coded in that sample is due to the issues brought to fore in this article. The data just isn't always there in the create controls part of the web part life cycle. I had much better luck getting my data and putting it somewhere, either the session or the viewstate during the ConnectionConsumer event, then setting the value to the control that needed to display it in the OnPreRender event, or just somehow binding to the control, say in a grid, and just calling refresh on the List I was using as a datasource in the OnPreRender, calling Refresh in the create controls didn't work reliably, only in OnPreRender.

Once I truly grokked the web part lifecycle, things became much simpler for me, and finally taught me why in Java portlets they went with the post/redirect/get cycle to try and avoid this very granular coordination between various portlets on a page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文