• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 819
  • Last Modified:

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

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.?
0
robjay
Asked:
robjay
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
kraffayCommented:
Here's the MSDN page for the data grid:

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref16/html/T_System_Web_UI_WebControls_DataGrid_Members.htm

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.
0
 
strickddCommented:
The GridView control has an Empty Date Template:

<EmptyDataTemplate>
   Enter text here.
</EmptyDataTemplate>
0
 
ethothsCommented:
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...
    http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagrid.aspx

Of course the intellisense in VS2005 is rather excellent.

This is a good how to site
    http://aspnet.4guysfromrolla.com/articles/041702-1.aspx
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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

0
 
strickddCommented:
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?
0
 
kraffayCommented:
The GridView has a template, but the DataGrid does not.
0
 
strickddCommented:
Oh, okay. I misread the question.
0
 
robjayAuthor Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now