Solved

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

Posted on 2006-11-15
8
761 Views
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.?
0
Comment
Question by:robjay
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 9

Assisted Solution

by:kraffay
kraffay earned 125 total points
Comment Utility
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
 
LVL 28

Expert Comment

by:strickdd
Comment Utility
The GridView control has an Empty Date Template:

<EmptyDataTemplate>
   Enter text here.
</EmptyDataTemplate>
0
 
LVL 11

Accepted Solution

by:
ethoths earned 125 total points
Comment Utility
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
 
LVL 11

Expert Comment

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

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 28

Expert Comment

by:strickdd
Comment Utility
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
 
LVL 9

Expert Comment

by:kraffay
Comment Utility
The GridView has a template, but the DataGrid does not.
0
 
LVL 28

Expert Comment

by:strickdd
Comment Utility
Oh, okay. I misread the question.
0
 

Author Comment

by:robjay
Comment Utility
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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Calling a function in different page from another page 6 32
varchar (max) 5 28
JavaScript error 1 32
Different Delete Messages 7 4
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net 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…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now