嵌套中继器控件上的视图状态大小很大 [英] view state size is huge on nested repeater controls

查看:68
本文介绍了嵌套中继器控件上的视图状态大小很大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有要求,例如我们必须向用户显示一些问题.当用户重新指向此页面时,它将显示所有父母问题.父母问题可以有子问题.子问题可以升至第六级.关于父母问题的是或否,它将显示孩子的问题.

为了实现此要求,我使用了嵌套的转发器控件直到第6级.在转发器中表示转发器六次.在每个转发器的itemTemplate中,我正在使用用户控件.用户控件包含一些标签和一个下拉列表.使用此用户控件在每个嵌套转发器的项目模板中.在父问题下拉列表的选定更改事件上,我们从数据库中获取子问题并绑定嵌套转发器.

从功能上讲,它的工作正常.我面临的问题是视图状态的大小.即使转发器包含单个数据并且没有子问题,页面的大小也超过30 MB.页面的性能非常慢.在selectedindex更改过程中,耗时超过2分钟.

我试图使用压缩逻辑将视图状态存储在服务器的文件系统上.页面的性能急剧下降.花了50秒才能得到子级问题.Tha的databse对象经过了精确调整,存储没有问题过程
存储的过程几乎不需要2秒就能得到孩子的问题.

我试图将更新面板放入嵌套的中继器中.性能相同.因为该页面包含将近100个qs的客户端,希望提高性能.

有人可以帮我解决这个问题吗.为什么在中继器中视图状态的大小更大,即使它包含一个数据也是如此.任何帮助或任何方法都非常值得.

we have requirement like we have to show some questions to users.when users rediecting to this page it will show the all parents questions.the parents question can have child question.the child question can go up to sixth level.on selection of yes or no on parents question it will show the child question.

To implement this requirement I am using nested repeater controls up to 6th level.means repeater inside repeater six times.In the itemTemplate of each repeater I am using the user controls.the user controls contains some label and one dropdownlist.this user controls is used in the item template of each nested repeater.on selected change event of dropdown of the parent questions we are getting the child question from the database and binding the nested repeater.

Functionality wise its working fine.The problem I am facing is the size of the view state.Even if the repeater contains a single data and no child questions the size of the page is more than 30 MB.The perfermancs of the page is very slow.on selectedindex change its taking more than 2 min.

I tried to store the view state on the file system of the server using the compression logic.the perfermance of the page drastically reduced.it was taking 50 sec to get the child questions.Tha databse object is purly tuned and no problem with the stored proc.
the stored proc hardly taking 2 sec to get the child questions.

I tried to put the update panel inside the nested repeater.the perfermance is same.as the page contains almost 100 qs client wants to improve the perfermancs.

can anybody help me out on this ..why the size of the view state is more in repeater evenif it contains one data.any help or any approach is much apprecited.

推荐答案

您是否看过 ViewState:减少性能开销的各种方法 [^ ]?有上百万篇关于该主题的文章.

更妙的是,在实际上不需要viewstate的所有控件(甚至页面上,如果可能)上设置EnableViewState = false.

使用ASP.NET跟踪输出查看视图状态的大小,如果确实需要启用某些视图状态,至少您将能够查看哪些控件对视图状态存储区有所贡献,并为除真正的控件之外的所有控件禁用视图状态需要它.
Have you looked at ViewState: Various ways to reduce performance overhead[^]? There are a million articles on the topic.

Better yet, set EnableViewState = false on all controls (or even the page if possible) that don''t actually require viewstate.

Use the ASP.NET trace output to view the viewstate size and, if you do need some viewstate enabled, at least you''ll be able to see which controls are contributing to the viewstate bucket and disable viewstate for all but the ones that really need it.


这篇关于嵌套中继器控件上的视图状态大小很大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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