private void gvwPrinterLocation_Paint(object sender, PaintEventArgs e) { try { DataGridView sndr = (DataGridView)sender; if (sndr.Rows.Count == 0) // <-- if there are no rows in the DataGridView when it paints, then it will create your message { using (Graphics grfx = e.Graphics) { grfx.DrawString("No data found!", new Font("Arial", 12), Brushes.Black, new PointF(25, 25)); } } } catch (Exception ex) {}}
<asp:GridView ID="gdvId" runat="server"> <Columns> </Columns> <EmptyDataTemplate> No resources found. </EmptyDataTemplate> </asp:GridView>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)