0
public static void ShowNoResultFoundGridWiew<T>(List<T> source, GridView gv, string text) where T : new()
{
if (source == null)
return;
source.Add(new T());
gv.DataSource = source;
gv.DataBind();
// Get the total number of columns in the GridView to know what the Column Span should be
int columnsCount = gv.Columns.Count;
gv.Rows[0].Cells.Clear(); // clear all the cells in the row
gv.Rows[0].Cells.Add(new TableCell()); //add a new blank cell
gv.Rows[0].Cells[0].ColumnSpan = columnsCount; //set the column span to the new added cell
// You can set the styles here
////gv.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
////gv.Rows[0].Cells[0].ForeColor = System.Drawing.Color.Red;
////gv.Rows[0].Cells[0].Font.Bold = true;
// Or you can pass a css class name
//gv.Rows[0].Cells[0].CssClass = "EmptyDataRowStyle";
gv.Rows[0].Cells[0].Text = text;
}
我该如何创建山姆方式空行中继器?可能吗。我不知道如何添加行并清除它...空行中继器动态
嗨,thx对于如此快速的回答。我将使用标签并显示文字... – senzacionale 2010-09-16 20:40:43