62,052
社区成员
发帖
与我相关
我的任务
分享
页面上:
<style type="text/css">
.fixColleft1
{ z-index:120; left:expression(this.offsetParent.scrollLeft); position: relative; background:#fff}
.fixedHeader {overflow: auto;}
</style>
后台代码:你的gridview绑定数据的方法中
/// <summary>
/// gridview数据绑定
/// </summary>
private void StoreListBind(string strCondition)
{
SqlDataReader drStorage = back.getStoreList(Pager.PageSize, Pager.CurrentPageIndex, false, strCondition);
if (drStorage != null)
{
DataTable dtStorage = tools.ConvertDataReaderToDataTable(drStorage);
dtStorage.TableName = "EC_Web_StoreInfo";
//主要是这里
gdvStore.CssClass = "fixedHeader";
this.gdvStore.Columns[0].HeaderStyle.CssClass = "fixColleft1";
this.gdvStore.Columns[0].ItemStyle.CssClass = "fixColleft1";
this.gdvStore.DataSource = dtStorage.DefaultView;
gdvStore.DataBind();
}
}