How To Show A Message When DataList Is Empty
In this tutorial i will let you know How To Show A Message When DataList Is Empty.Today i am working on project and requirements come to me is to display a message when datalist is empty, not a big deal.I have done it earlier through 4-5 lines of code.
But today i want it to do in more efficient way, means only a single line of code, and we got what we want.For this we just have to use Footer Template in our DataList.
Just add a line on Footer Template, nothing else we need to write down on code file.
Design View:
<FooterTemplate> <asp:Label Visible='<%#bool.Parse((DataList1.Items.Count==0).ToString())%>' runat="server" ID="lblRecord" Text="No Record available!"></asp:Label> </FooterTemplate>
Done, Enjoy
One reply on “How To Show A Message When DataList Is Empty”
very good