从更新面板写入文本框

发布于 2024-07-17 04:25:44 字数 237 浏览 4 评论 0原文

我正在尝试从更新面板中完成的部分回发访问文本框的 Text 属性。 问题是我想要访问的这个文本框不在此更新面板中,当我尝试写入它时(将内容放入 Text 属性中),此新内容未显示。

我认为这是因为这个文本框不是更新面板的一部分,但我不确定。 而且,我无法将此文本框与触发部分回发的文本框放在同一更新面板中。

为什么不显示文字?

I am trying to access the Text property of a textbox from a partial postback-done in an Update Panel. The problem is that this textbox I want to access is not in this Update Panel, and when I am trying to write to it (putting content in the Text property), this new content is not being displayed.

I think that this is because this textbox is not part of the Update Panel's, but I'm not sure about it. And also, I cannot put this Textbox in the same update panel as the one I'm triggering a partial postback.

Why isn't the text being displayed?

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

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

发布评论

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

评论(3

南汐寒笙箫 2024-07-24 04:25:44

在部分页面呈现期间,只有更新面板中包含的控件才会刷新其 html。 页面的其余部分将保持不变。

对于您的具体情况,您需要将文本框包装在更新面板中,然后您就可以做出决定。 您可以将其 UpdateMode 标记为“始终”或“条件”。 如果将其标记为始终,则该更新面板中包含的所有控件都将在每次部分渲染期间更新。 如果您将其标记为有条件的,那么您将需要调用更新面板的 Update() 方法来刷新其 html。

During a partial page rending only controls contained within an update panel will have thier html refreshed. The rest of the page will remain the same.

For your specific case you would need to wrap your text box in an update panel, then you hnave a decision to make. You can either mark its UpdateMode as Always or Conditional. If you mark it as always then all the controls contained within that update panel will get updated durning every partial rendering. If you mark it conditional then you will need to call the update panels Update() method to have it's html refreshed.

沉默的熊 2024-07-24 04:25:44

我认为您不能,除非您将文本框放在第二个更新面板中,并将更新模式设置为“条件”。 然后,您调用更新方法或将第一个更新面板设置为新面板的 asyncpostbacktrigger。

I don't think you can, unless you put the text box in a second update panel with the update mode set to Conditional. Then you invoke the update method or set the first update panel as an asyncpostbacktrigger to the new one.

以歌曲疗慰 2024-07-24 04:25:44

除非您将相关文本框放入另一个更新面板中,否则无法完成您想要做的事情。如果您想在其他事件下使用文本框的内容,请将新更新面板的更新模式设置为始终。 但是,如果您只想在触发其他更新面板的事件期间访问其 Text 属性,则将 updatemode 设置为有条件,并将两个面板的触发器设置为相同...

如果您不确定触发器和updatemode(基本上是如何工作的)然后只需在两个 updatepanels 中将 updatemode 设置为始终,然后忘记触发器。
那么它会工作得很好...

What you are trying to do cannot be done unless you put the textbox in question inside another update panel.And if you want to use the contents of your textbox under other events then set the updatemode for the new updatepanel to always. But if you want to access its Text property only during the event which is the trigger for your other update panel then set the updatemode to conditional and also set the triggers of both the panels as same...

If you are not sure about triggers and updatemode (basically how it works) then just set updatemode to always in both updatepanels and forget about the triggers.
It will work fine then...

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