what I learn is what u c

Creating dynamic, fancy EmptyDataText for GridView

with 2 comments

Gridview has capability to display “default” messages when “No data” exists during binding.

Standard Way in .aspx

<asp:GridView ID=”gvControl” runat=”server” AutoGenerateColumns=”False” GridLines=”None” CellPadding=”0″ CellSpacing=”0″ OnRowDataBound=”gvCategories_RowDataBound” BackColor=”#dddddd” ShowHeader=”false” EmptyDataText=”<BR> No data exists <BR><BR>“>

Fancy Way (.vb or .cs)

You can make it fancy & dynamic by doing it in code behind.


Create fancy texts using WordArt (MS Word) and copy it to Image Editor (, gimp, Paint) and save it as JPG.

gvControl.EmptyDataText = "<img src='~/images/NoData.jpg' border='0'>"
gvControl.EmptyDataRowStyle.HorizontalAlign = HorizontalAlign.Center

Note: When you use emptydatatext in codebehind donot forget to use databind.

Written by gchandra

October 24, 2007 at 2:17 pm

Posted in Asp.Net, Web Coding

Tagged with , ,

2 Responses

Subscribe to comments with RSS.

  1. Tnks.

    this is a good article.


    May 6, 2008 at 10:40 am

  2. very nice


    January 24, 2010 at 4:54 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: