单击按钮异步加载用户控件
我有 2 个用户控件,每个都位于不同的更新面板中。我还在这两个更新面板之外有一个按钮。在此按钮上单击我正在尝试调用用户控件中的方法。
在按钮单击未完成之前它不会显示数据,因此我的两个用户控件同时加载。我想异步加载这些用户控件,即一旦该用户控件中的方法完成,我希望显示数据。我应该改变什么才能使其正常工作。
usercontrol 中的方法基本上是为用户控件创建动态 html。
我在按钮单击中调用用户控制方法,因此它是按顺序发生的。 UpdatePanel 的 Unload 事件发生在最后,有没有办法可以通过单击按钮引发此事件。
I have 2 usercontrol, each in different-different updatepanel. Also I have a button outside these 2 updatepanels. On this button click I am trying to call the method in usercontrol.
It doesn't displays the data till button click is not complete, so my both user controls load at the same time. I want to load these user control asynchronously i.e as soon as method in that usercontrol finishes, I want data to be displayed. What should I change to make it work properly.
The method in usercontrol is basically creates dynamic html for the user control.
I am calling the user control method in button click, so it is happening sequentially. UpdatePanel's Unload event occurs at the end, is there a way I can raise this event from button click.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解您的问题(这并不容易),您需要在用户控件中使用某种
FinishedLoading
事件,并将其委托放在您的页面上,您可以将其可见性设置为 true。If I understood your question correctly (which isn't that easy), you need some sort of
FinishedLoading
event in your user controls and have its delegates on your page where you'd set their visibility to true.