这是否可能添加网格视图数据标题的空白行上方 [英] is this possible add blank row upper side of header of grid view data
本文介绍了这是否可能添加网格视图数据标题的空白行上方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这可以在网格视图标题部分上方添加一个空行
如果可能的话我们怎样才能实现这个???
解决方案
看看这篇CP文章 - 动态多行列网格标题 [ ^ ]并将其调整为只有一个空白行
您好,
尝试以下一个。它将根据您的要求在上面的标题上创建空行。
//为gridview添加数据绑定事件
protected void gvDividendReport_DataBound(object sender ,EventArgs e)
{
//查找标题控件行
GridViewRow row = new GridViewRow(0,0,DataControlRowType.Header,DataControlRowState .Normal);
//创建标题单元格
TableHeaderCell cell = new TableHeaderCell();
cell .Text =客户; //命名为标题。因为你需要将空行设置为空文本
cell.ColumnSpan = 7; // gridview中的列数
row.Controls.Add(cell);
row.BackColor = ColorTranslator.FromHtml(#3AC0F2); //如果需要行背景颜色
gvDividendReport.HeaderRow.Parent.Controls.AddAt(0,row);
}
is this possible to add a blank row in above the grid view header part
if possible then how can we achieve this???
解决方案
Have a look at this CP article - Dynamic Multiple Row Column Grid Header[^] and adapt it to just have a blank row
Hi,
Try below one. It will create empty row on above header as per your requirement.
//Add databound event for gridview
protected void gvDividendReport_DataBound(object sender, EventArgs e)
{
//finding header control row
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
//Creating header cell
TableHeaderCell cell = new TableHeaderCell();
cell.Text = "Customers"; //Naming to header. As you need empty row set as empty text
cell.ColumnSpan = 7; //Number of columns you have in gridview
row.Controls.Add(cell);
row.BackColor = ColorTranslator.FromHtml("#3AC0F2"); // Row background color if required
gvDividendReport.HeaderRow.Parent.Controls.AddAt(0, row);
}
这篇关于这是否可能添加网格视图数据标题的空白行上方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文