Showing posts with label how to apply dynamic text in gridview. Show all posts
Showing posts with label how to apply dynamic text in gridview. Show all posts

Sunday, 18 May 2014

How to apply dynamic text to the gridview empty data template in ASP.NET

In this article, i am going to give some overview on how to set text in EmptyDataTemplate Dynamically. First We have to define a label in EmptyDataTemplate and call the specified function in its Text Property. After that, just declare the specified function at anywhere in aspx.cs page. Something Like this:-
aspx page

aspx.cs page
    protected string BindEmptyText()
    {
        if (gvOrders.Rows.Count == 0)
        {
            return "No order was made!!"; // if no row found
        }
        return string.Empty; // if any row found
    }
To sort data in gridview http://dotnetcodingcircle.blogspot.in/2014/05/how-to-sort-data-in-gridview-in-aspnet.html


That’s it!!…..Happy Programming...