473,661 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying Message When DataGrid is empty

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
Nov 19 '05 #1
2 3412
You can use

if (datagrid.Items .Count == 0)
{
Page.RegisterSt artupScript("me ssage", "<script>alert( 'no
records')</script>")
}

to show the message.

HTH

Elton Wang
el********@hotm ail.com
"Bidarkota" wrote:
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

Nov 19 '05 #2
Something along these lines should do the trick:

If MyDataSet.Table s(0).Rows.Count =0 then
lblNoRecords.Vi sible=True
Else
MyDataGrid.Visi ble=True
End If

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Bidarkota" <pr******@yahoo .com> wrote in message
news:16******** *************** ***********@mic rosoft.com...
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

Nov 19 '05 #3

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

Similar topics

2
1842
by: Stephen | last post by:
I'm trying to work with a datagrid column in order to display a tooltip in a datagrid cell. The reason I am doing this is because I have some long strings being returned and I don't want the rows of the datagrid expaning down to much. I basically want to display the first 50 characters in the grid cell and then display the rest as a tooltip in the grid cell. I'm not sure if this is possible but if anyone can help me do this I would be very...
3
2539
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
3
4913
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls are Web Control & not HTML control. One of these buttons whose title is Delete is added on the aspx page in design view & also I double clicked on this button in design view to get the onclick code for this button in the code behind page. & for...
4
2199
by: Tim T | last post by:
Hi, I have a stored procedure executing a search and an asp.net page displaying the results in a datagrid. The datagrid has paging on it, I am using Visual Studio.NET and can't see any option to show the number of results found. Is there an easy way to add this to the top of the datagrid, along with the total number of pages ie: 67 resuts found page 1 of 7 (where the numbers in are hyperlinks to that
1
1311
by: holy | last post by:
Hi If the DataSource is empty, I just want to avoid showing the Empty DataGrid with Column headers. How can I do this TIA Holysmoke
4
1627
by: starwiz | last post by:
I'm trying to use the DataGrid's editing with a DropDownList. I've tried using every code sample I've seen and none of them seem to be able to solve my problem. When I call e.Item.FindControl("name-of-my-DropDownList"), where e is a DataGridCommandEventArgs passed to the UpdateCommand of the DataGrid, I get an empty DropDownList. In fact, when I call e.Item.FindControl("name-of-a-label") in the non-editable portion of my template, I...
0
1693
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a single worksheet into a dataset. I successfully built a dynamic datagrid. And I did successfully bind it to the dataset. Then I added the datagrid control to a PlaceHolder. The first worksheet displays beautifully. The next step is to allow...
2
1972
by: .Net Sports | last post by:
I have a data grid that takes data from a data table, and in visualstudio.net, I cannot find the error in the debugger at why I am not able to see my datagrid when querying data for a specific date when I step thru the code while debugging. ON strSQL when mousing over the variable, it indicates its empty. Just can't find where or why it is empty. Code below (excuse the formatting in this textarea box):
1
1391
by: sushant2009 | last post by:
Hi , I want to display empty databae table(actually table contains lot of records) to datagrid using dataset and dataadpter. After displaying i will fill new records in datagrid and i will save it in above thing i want to save new records using datagrid,dataset and dataadpter withought displaying previous ones Some one will tell me please how to do this
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8754
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
8542
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
7362
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
6181
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
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
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.