先看效果:
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)

孟子以前也做过这事,不过他的方法前台后台都要弄,还是VB的(^-^),好像也不支持像我的自动生成列的DataGrid,所以还是自己动手,纯脚本搞掂,其实很简单,就几行:

纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)      
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)  function ScrollDataGrid() 
 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)<table width="100%" border="0" id="tbHeader" cellpadding="4" cellspacing="0"> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                        
</table> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                        
<div style="OVERFLOW-Y: scroll; HEIGHT: 300px" id="dvBody"> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                            
<asp:datagrid id="dgSearchResult" style="BORDER-COLLAPSE: collapse" runat="server" Width="100%" CellPadding="4" DataKeyField="编号" BorderWidth="1px" BorderStyle="Solid" BorderColor="RoyalBlue" GridLines="None"> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                
<SelectedItemStyle ForeColor="SlateGray"></SelectedItemStyle> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                
<ItemStyle VerticalAlign="Middle"></ItemStyle> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                
<HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                
<Columns> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                    
<asp:ButtonColumn Text="选择" HeaderText="&lt;font face=webdings&gt;6&lt;/font&gt;" CommandName="Delete"> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                        
<HeaderStyle Wrap="False" Width="40px"></HeaderStyle> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                        
<ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                        
<FooterStyle Wrap="False"></FooterStyle> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                    
</asp:ButtonColumn> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                                
</Columns> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘)                                            
</asp:datagrid></div> 
纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘) 

相关文章:

  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
  • 2021-08-22
  • 2021-05-29
猜你喜欢
  • 2021-12-06
  • 2021-10-16
  • 2022-12-23
  • 2021-08-23
  • 2021-12-28
  • 2022-12-23
相关资源
相似解决方案