Show message "no results" in gridview

0

How can I display a message so that when I search in a datagridview if there are no results the message is displayed.

    
asked by KlonDTS 09.12.2016 в 22:20
source

2 answers

4

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 .

    
answered by 09.12.2016 / 22:31
source
1

GridView (Class)

define the template of:

EmptyDataRowStyle

with this you can specify that it will be shown when there is no data.

    
answered by 09.12.2016 в 22:25