How can I display a message so that when I search in a datagridview if there are no results the message is displayed.
How can I display a message so that when I search in a datagridview if there are no results the message is displayed.
Use EmptyDataText :
Example:
<asp:GridView ID="CustomersGridView"
runat="server"
AutoGenerateColumns="true"
DataSourceId="CustomersSqlDataSource"
EmptyDataText="No hay resultados.">
<EmptyDataRowStyle BackColor="LightBlue"
ForeColor="Red"/>
</asp:GridView>
To apply styles to the No hay resultados
message, review the links that the SoftMolina user has placed in their answer .
define the template of:
with this you can specify that it will be shown when there is no data.