UltraWebGrid如何廋身

来源:互联网 发布:数控雕刻机编程 编辑:程序博客网 时间:2024/04/29 15:40

我们在使用UltraWebGrid时,如果使用其默认的设置时,返回到客户端的Html相当大。当表格中的数据超过1000行时相当的慢。我原来使用时有的页面竟然有4M多,吓人吧!也就是在局域网上的企业应用,要是放到Internet中,谁还能用这样的系统。UltraWebGrid产生的无用HTML多有很多原因,因为此控制的强大,客户端控制更是强大,什么都可以在客户端控制和使用,所以要产生相当多的HTML和JavaScript来完成,复杂的操作,你可以查看源代码看看,一大堆的垃圾。

    要想廋身还要看你使用的场合。主要可以控制的属性有:

   EnableViewState :如果你不在服务器端来操作UltraWebGrid,可以考虑设置为false,这样可以减少20-30%的HTML输出

   ReadOnly:这个属性很几个值,当你不需要在客户端操作UltraWebGrid时可以设备成"LevelZero",这样可以减少30-40%的HTML输出.LevelZero是UltraWebGrid是最轻量的,你可以试试,看看前台代码,很精简。

 

如果EnableViewState=false ,ReadOnly=LevelZero,差不多可以减少50%的HTM输出,数据是我大约看出来的。

 

ReadOnly:各属性说明

NotSetHTML is generated in full without any restrictions. LevelZeroNo ViewState and no JavaScript are generated. The grid is completely passive. LevelOneNo ViewState is generated and minimum of JavaScript is generated. Functionality available includes: expand and collapse rows, change a column's width. LevelTwoNo ViewState is generated and minimum of JavaScript is generated. Functionality available includes: expand and collapse rows, change a column's width, and stationary margins. PrintingFriendlyRenders the WebGrid in a manner to allow for printing of the component. The grid is completely passive.

 

还有就是要使用样式来控制显示风格,Infragistics for asp.net套件如何统一样式风格 ,不要用内连的方式

 

如果你还发现其它的,请之

 

 

原创粉丝点击