冻结Web应用程序中的网格列和标题 [英] Freeze grid column and header in web application

查看:95
本文介绍了冻结Web应用程序中的网格列和标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

冻结Web应用程序中的网格列和标题

推荐答案

您好,

A.对于冻结标题:
Hi,

A. For freezing Headers:
Step 1: Create a CSS class

.HeaderFreeze  
{  
position:relative ;   
top:expression(this.offsetParent.scrollTop);  
z-index: 10;  
}   

Step 2: Set Gridview’s HeaderStyle CssClass as follows
CssClass="HeaderFreeze"



B.对于冷冻柱:



B. For freezing Columns:

Step 1:   Add locked Css:
td.locked, th.locked 
{
  position:relative;    
  left:expression ((this.parentElement.parentElement.parentElement.parentElement.scrollLeft-2)+''px'');
}   

Step 2:   In RowDataBound event add css to GridView cell something like:
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[0].CssClass = "locked";
        }
    }


这篇关于冻结Web应用程序中的网格列和标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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