The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Empty Datagrid

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Paschal

Posts: 1621
Nickname: bigapple
Registered: Nov, 2003

Paschal is a .Net developer
Empty Datagrid Posted: Jan 13, 2004 3:41 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Paschal.
Original Post: Empty Datagrid
Feed Title: help.net
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/pleloup/Rss.aspx
Feed Description: .Net for mankind !
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Paschal
Latest Posts From help.net

Advertisement

I received an interesting comment from Jan Tielens about how to display an empty datagrid:

Hi guys, thanks for having me! ;-)

For the record, my work regarding datagrids is for Windows.Forms, so my opinion expressed here will also be for the Windows.Forms grid. Although maybe it's applicable for Web.Forms too, but I'm not in the position to judge about that.

First of all: it's an intresting question! To be honest I haven't thought about it yet. If I design a Windows.Forms form that shows a DataGrid, initially it will be empty (no data, message or column headers). I rarely create a from that shows data in a grid the first time I show it. I consider it "bad design" when people fill a grid with all the customers from the database, the first time a search form is displayed, because in 90% of the cases the user will want to search using his own criterea. But that's another discussion...

So how should the empty datagrid look like? It's technically possible to show the column headers by putting an empty collection in the grid. If we take a look at Microsoft how they do it for example when you use the "Search For Files or Folders", we'll see that they show the column headers and display the text "Enter your search criterea to begin.". Technically this is only possible if the first column of the grid can contain string values and is wide enough (or you should use a label or something that you display in front of the grid). Ofcourse the Microsoft search window uses a ListView control, that always shows it's columns, instead of the DataGrid control.

Personally I don't mind if the empty grid is a "grey box". If you want to be nice to your users, you can show a text by using the CaptionText property of the grid and/or you can display the column headers. From a user interface and user experience point-of-view it's a nice-to-have feature if the column headers are shown when the form is in it's initial state.

FYI: The home page for the ExtendedDataGrid is
http://dotnet.leadit.be/extendeddatagrid

My two cents on this Jan is about the case where you have the autogenerate columns enabled.

Basically you need in this case to have a sort of dataset, with some dummy values.
The other solution is probably to look at the last article on MSDN magazine from Dino Esposito.

He override the Render method to modify the Datagrid. So probably we can do the same to display something nice when no data are present.
The other idea is maybe to look at the undocumented method Dino used in his article CreateColumnSet.

 

Read: Empty Datagrid

Topic: Webcast Reporting Services Online Launch Event Previous Topic   Next Topic Topic: Creating Atom Feeds with .NET

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use