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;
}
Comment puis-je créer une rangée vide pour le répéteur? C'est possible. Je ne sais pas comment ajouter des lignes et les effacer ...ligne vide répéteur dynamiquement
salut, merci pour la réponse si rapide. Je vais utiliser l'étiquette et afficher le texte ... – senzacionale