GridView - Show headers on empty data source

后端 未结 16 1293
挽巷
挽巷 2020-11-28 11:22

In C# how do I still show the headers of a gridview, even with the data source is empty.

I am not auto generating the columns as they are all predefined.

C

16条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-28 12:13

    Use an EmptyDataTemplate like below. When your DataSource has no records, you will see your grid with headers, and the literal text or HTML that is inside the EmptyDataTemplate tags.

    
        
            No Results Found
        
        
            
            
            ...
        
    
    

提交回复
热议问题