Does .NET 2.0 offer a DataGrid equivalent to the GridView "EmptyDataText"

Posted on 2006-11-15
Last Modified: 2010-08-05
I would like to add this feature to my DataGrid and I'm unsure if 2.0 now offers this capability:

EmptyDataText="There are no data records to display."

Also, is there a good website that has all of the options available for DataGrid, i.e. like
AutoGenerateColumns, AlternatingItemStyle-BackColor, OnItemDataBound, EmptyDataText, etc.?
Question by:robjay
  • 3
  • 2
  • 2
  • +1

Assisted Solution

kraffay earned 125 total points
ID: 17949058
Here's the MSDN page for the data grid:


As for the empty data, I usually but a hidden label on the page, and if there are no results, I set the text to something like "no records found" and make it visible.
LVL 28

Expert Comment

ID: 17949084
The GridView control has an Empty Date Template:

   Enter text here.
LVL 11

Accepted Solution

ethoths earned 125 total points
ID: 17949092
Not that I'm aware of. You would have to code this in the code behind, say in the onprerender event of your page.

I don't know of a good reference sit eother than the msdn site...

Of course the intellisense in VS2005 is rather excellent.

This is a good how to site
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 11

Expert Comment

ID: 17949099
I stand corrected by strickdd. Thanks, I was looking for a property but I guess it makes sence that its a template.

LVL 28

Expert Comment

ID: 17950092
excuse me, but I do think I gave the answer that was needed... ethoths even pointed that out. Why didn't I get any points?

Expert Comment

ID: 17950480
The GridView has a template, but the DataGrid does not.
LVL 28

Expert Comment

ID: 17950513
Oh, okay. I misread the question.

Author Comment

ID: 17950580
Appreciate your enthusiasm strickdd.  I think ethoths also misunderstood the applicability of your reply too hence his reply to you.  Thanks all for your help.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
edit .asp files 5 42
How to use NFS (Network File System) in mvc 5? 4 55
Adding items to a C# list incrementally 5 58 mvc , views, hidden values ? 2 22
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question