GridView is coming with a new element called EmptyDataTemplate and a property EmptyDataText. As you guessed, this template or property will be showed when you bind an empty datasource( for example dataset without any rows) to GridView. Though it is a simple feature, it was not there in previous databound controls like repeater and datagrid. We used to manually find out whether datasource is empty or not, depending upon that we will show some panel or message. Now you can use this feature for that.
Empty DataText property can be used to show a message to the user in case of empty datasource.
EmptyDataTemplate can be used to mention template( i.e. any controls..) to show in case of empty datasource. The template can also be used to show simple message. For example
<asp:GridView ID="GridView1" Runat="server" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False" EmptyDataText="No Product" >
<EmptyDataTemplate >
There in no product in your cart.
</EmptyDataTemplate>
<Columns>
<asp:BoundField HeaderText="au_lname" DataField="au_lname" />
<asp:BoundField HeaderText="au_fname" DataField="au_fname" />
<asp:BoundField HeaderText="phone" DataField="phone" />
<asp:BoundField HeaderText="address" DataField="address" />
</Columns>
</asp:GridView>
If you mention both EmtpyDataText and EmptyDataTemplate, then EmptyDataTemplate takes precedence.
Free e-book - Dissecting a C# Application: Inside SharpDevelop is available in Apress.com.
Here is the short introduction about this book,
Learn advanced .NET programming techniques by getting an insiders' look at a complete application! The developers who created SharpDevelop give you an inside track on application development with a guided tour of the source code for SharpDevelop. They will show you the most important code features and explain how you can use these techniques in your own projects. You will gain valuable experience of building an application on this scale, learning from the decisions, mistakes, problems and solutions that lead to the current version on SharpDevelop.