使用仅加载活动视图的多视图控制问题 [英] using multiview control problem with loading only active view

查看:62
本文介绍了使用仅加载活动视图的多视图控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我使用的是多视图Web控件,其中大约有10个视图,每个视图都有对用户控件(ascx页)的引用.使用下一个"或上一个"按钮,我正在切换活动视图.在我的多视图中,我将活动视图索引设置为第一个视图.
我唯一的问题是我只想加载活动视图,但要运行后续视图的所有asp页面生命周期.即它正在达到所有视图的页面加载事件的所有断点.在页面加载中,我有很多数据库调用,我只想触发活动视图的页面加载事件.我看过这篇文章
https://msmvps.com/blogs/luisabreu/archive/2008/02/20/multiview-control-should-you-use-it.aspx [ 昏暗的ActiveView为String = myMultiview.GetActiveView.ID
如果activeView一无所获,那么
contentPlaceHolder.FindControl(activeView).RenderControl(writer)
如果结束
结束子

如果有人能指出正确的方向,我将不胜感激.感谢

Hi, I am using multiview webcontrol within which I have about 10 views, each view has a reference to user control (ascx page). with button Next or Prev I am switching active views. In my multiview I have set active view index to be the first view.
My only problem is I want to load only active view but its running all the asp page life cycle of sub-sequent view. i.e it is hitting all the break points of page load event for all the views. in page load i have lots of db calls and I want to only trigger the page load event for the view that is active. I have went through this article
https://msmvps.com/blogs/luisabreu/archive/2008/02/20/multiview-control-should-you-use-it.aspx[^]

but its not helping, I am using vb code so I changed this to below code as per above article

Protected Overrides Sub Render(writer As HtmlTextWriter)
Dim contentPlaceHolder As ContentPlaceHolder = DirectCast(Master.FindControl("cphBody"), ContentPlaceHolder)
Dim activeView As String = myMultiview.GetActiveView.ID
If activeView IsNot Nothing Then
contentPlaceHolder.FindControl(activeView).RenderControl(writer)
End If
End Sub

I would really appreciate if anyone can point me to right direction. thanks

推荐答案

有人吗?所以我应该假设我不应该使用多视图控件吗?
anybody? so should I assume I shouldnt use multiview control?


好吧.那么最好的方法是什么,这样我才能获得良好的表现?
oh ok. so what will be the best way so I could get good performance in my case?


这篇关于使用仅加载活动视图的多视图控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆