数据库驱动的WEB应用程序性能(与服务器无关)

刚刚做了一个项目,在一个页面上显示某公司全体员工的基本信息。我们选择使用GRIDVIEW显示,而且根据客户要求,不能采用分页。这时,出现了一个问题:当页面上纪录数比较多时,页面响应变得相当迟钝。

刚开始,我以为是服务器的问题,可后来一想不对:数据库操作的记录树目是一定的,为什么 现实的记录少的时候就不存在这个现象? 一番推力论证过后,我学会了一点新的东西,那就是浏览器在前段现实的时候要将服务器端得东西翻译成她自己的东西:像GRIDVIEW在服务器端仅仅几行代码:

< asp:GridView ID = " GV_EmployeeInfo "  DataKeyNames = " EmployeeInfoID "  runat = " server "  DataSourceID = " ODS_EmployeeInfo " >

而到了客户端,代码就变成了N行类似这样的代码:

 

< table  class ="EmployeeName" >
                                      
< tr >
                                          
< td >
                                          
< id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_LinkButton1"  class ="ViewFont"  href ="javascript:__doPostBack('ctl00$ListPlaceHolder$GV_EmployeeInfo$ctl14$LinkButton1','')" > 孙婷婷 </ a >
                                          
</ td >
                                     
</ tr >
                                
</ table >
                                    
                                
</ td >< td >
                                
< table  class ="PINYIN" >
                                        
< tr >
                                            
< td >
                                             
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label11"  class ="ViewFont" > Sun,tingting  </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >
                                   
                                
</ td >< td >
                                    
< table  class ="EnglishName" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label12"  class ="ViewFont" >   </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="Date" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label7"  class ="ViewFont" > 2005-07-01 </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                    
                                
</ td >< td >
                                
< table  class ="EmployeeType" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label1"  class ="ViewFont" > FTE  </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="Graduate" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label13"  class ="ViewFont" > 2005 </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="Graduate" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label14"  class ="ViewFont" > N/A </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="Degree" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label2"  class ="ViewFont" > 本科  </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="Sex" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label3"  class ="ViewFont" > Female </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                    
                                
</ td >< td >
                                
< table  class ="RDGA" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label4"  class ="ViewFont" > RD  </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="EnglishLevel" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label15"  title =" "  class ="ViewFont" >   </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="University" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label16"  title ="浙江大学 "  class ="ViewFont" > 浙江大学  </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                
</ td >< td >
                                
< table  class ="Major" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label5"  class ="ViewFont" > 信息管理与信息系统  </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >
                                
</ td >< td >
                                
< table  class ="WorkStatus" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl14_Label6"  class ="ViewFont" > Active   </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >  
                                    
                                
</ td >
                        
</ tr >< tr  onmouseover ="backcolor=this.style.backgroundColor;this.style.backgroundColor='#B7C7E5'"  onmouseout ="this.style.backgroundColor=backcolor"  style ="background-color:White;" >
                            
< td >
                                    
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl15_Label9" > 14 </ span >
                                
</ td >< td >
                                
< input  type ="submit"  name ="ctl00$ListPlaceHolder$GV_EmployeeInfo$ctl15$Button15"  value ="Edit"  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl15_Button15"  class ="ButtonCss"   />
                                
</ td >< td >
                                    
< table  class ="EmployeeID" >
                                        
< tr >
                                            
< td >
                                            
< span  id ="ctl00_ListPlaceHolder_GV_EmployeeInfo_ctl15_Label8"  class ="ViewFont" > F00020 </ span >
                                            
</ td >
                                        
</ tr >
                                    
</ table >

当每次有页面操作时,浏览器都会以类似方式重绘这些服务端代码,这项工作何其烦大?于是乎遍有了开头的“迟钝”现象。解决的办法可以采用人道主义方法说服客户采用分页,也可以采用分人道方法千方百计减少html代码。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值