473,804 Members | 3,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When no records in a DataGrid how to show a default alternative message?

Title says it all. Using ASP.Net v1.1. Want to show some message when there are no
records to show in a grid. Does one do that with the DataGrid control itself? Or in
CodeBehind should one conditionally fill in a label control only when one tests and
sees the resultset of a query is empty?

How do you handle this case?
Nov 19 '05 #1
1 3093
You could check the DataTable.Rows. Count to see if it carries values and not
display/bind the datagrid if it doesn't, or bind and hide the datagrid if
the DataGrid.Items. Count is zero. Of course any of those checks would allow
you to populate and show a conditional label with appropriate text.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Randall Parker" <NOtechieSPAMpu ndit_please@fut ure_avoidjunk_p undit.com>
wrote in message news:u4******** ******@tk2msftn gp13.phx.gbl...
Title says it all. Using ASP.Net v1.1. Want to show some message when
there are no records to show in a grid. Does one do that with the DataGrid
control itself? Or in CodeBehind should one conditionally fill in a label
control only when one tests and sees the resultset of a query is empty?

How do you handle this case?

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
3487
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the query: QryICTMassDistribution3) , I then use a form and the code below to create a new record in the corrispondence table to show what corrispondence has been sent to various companies.
5
2535
by: K | last post by:
I created a collection which is derived from ArrayList and implements IBindingList and ITypedList. Then I bound the DataSource of a data grid into the collection. It could show up the data but the column heading is not in the right order, for eg. I want "ID" column to be the first column but it showed as the second column. Another problem is that anyway i can leave a blank row in the grid to add a new row automatically if the user...
7
3533
by: uiranejeb | last post by:
Hi everybody, I am an asp.net datagrid that have all the rows editable. An user can update any column from datagrid. I'm trying to find a way to update only the rows that were updated. How can I handle this? Is there any possibility to get data row behind datagrid row?
2
1444
by: Steve Chatham | last post by:
I have a datagrid that I want to put sku information into. I can load the select info there, such as: Item# Description Weight etc. However, in the right hand column, or maybe to the right of the datagrid, I'd like to have a hyperlink displayed that would give me more specific information than what I have space to show in the datagrid. An alternative may be to have the user to click on the item number to display this info.
2
3423
by: Bidarkota | last post by:
I need to Display DataGrid Headers and the "no records" message when the DataGrid is empty, is there any way to achieve this. Thank you
1
2217
by: Aaron Smith | last post by:
I have a parent table that has one child table. The parent has a single field (ID, AutoIncrement, Seed 0, Step -1 in the DataSet, Seed 1, step 1, in DataSource). The child is linked to this ID column in the parent. I have the parent fields in textboxes and the child is a DataGrid. When I add a new parent record, then go to add child records, I am getting an exception that says, "ForeignKeyConstraint requires the child key values (0) to...
1
1248
by: jwogick | last post by:
I'm hoping someone can help me! I just have a simple form with a datagrid displaying child records from a dataset that contains two related tables Parent table>Clients Child table>cases. using the designer I tell the datagrid to display the child records only from the dataset (Relation called ClientsCases table>cases) it will display the data fine but when I add a new tablestyle with custom columns it does not change the columns in the...
13
1861
by: Saber | last post by:
I did a lot of searches and read something about datagrids. But I couldn't find the answer of my simple question, how can I show only my desired columns of a table? for example I wrote this sql query: OleDbDataAdapter1.SelectCommand.CommandText = & _ "Select illNameE From tblIllness" OleDbDataAdapter1.Fill(DsIllness1) But in my datagrid, I get (null) for other ccolumns instead
3
5403
by: Kai Zhang | last post by:
I am trying to display some database records in datagrid using dataset. the records need to be displayed are couple of thousands, but the records in database that the SQL query needs to exam are more than 70 thousand, and it is really slow to get the dataset ready to populate the datagrid. I am sure there are solutions on this issue, but I just don't know :-( Can anybody point me out any good solution to minimize the time used to...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10326
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.