skip navigation
Telerik UI for ASP.NET AJAX
Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
NEW
: Design Kits for Figma
Online Training
Document Processing Library
Embedded Reporting for web and desktop
Web
Kendo UI
UI for jQuery
UI for Angular
UI for React
UI for Vue
UI for Blazor
UI for ASP.NET Core
UI for ASP.NET MVC
UI for ASP.NET AJAX
UI for Silverlight
UI for PHP
UI for JSP
Mobile
UI for .NET MAUI
UI for Xamarin
Document Management
Telerik Document Processing
Desktop
UI for .NET MAUI
UI for WinUI
UI for WinForms
UI for WPF
UI for UWP
Reporting & Mocking
Telerik Reporting
Telerik Report Server
Telerik JustMock
Automated Testing
Test Studio
Test Studio Dev Edition
CMS
Sitefinity
UI/UX Tools
ThemeBuilder
Design System Kit
Debugging
Fiddler
Fiddler Everywhere
Fiddler Classic
Fiddler Jam
FiddlerCap
FiddlerCore
Extended Reality
UI for Unity XR
Free Tools
JustAssembly
JustDecompile
VB.NET to C# Converter
Testing Framework
View all products
Overview
Demos
Roadmap
What's New
Roadmap
Release History
Migrate to Blazor
Docs & Support
Pricing
Search
Shopping cart
Login
Contact Us
Try now
close mobile menu
Telerik Forums
/
UI for ASP.NET AJAX
This is a migrated thread and some comments may be shown as answers.
hide grid when no records
3 Answers
183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie
asked on
06 Mar 2009,
02:01 AM
i do not want to display the grid when there are no records found.
However, currently if there are no records it shows a thin line. How can i get rid of that?
Add a comment
Submit comment
Cancel
3 Answers
, 1 is accepted
Sort by
Score
Date
0
Princy
Top achievements
Rank 2
answered on
06 Mar 2009,
04:34 AM
Hi,
Try the following code snippet in order to hide the RadGrid when there's no records.
CS:
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
(RadGrid1.MasterTableView.Items.Count == 0)
{
RadGrid1.Visible =
false
;
}
}
Thanks,
Princy.
Add a comment
Submit comment
Cancel
0
newbie
Top achievements
Rank 1
answered on
06 Mar 2009,
06:53 PM
I am binding my grid in another function and not in the needdatasource event.
This code always renders my grid as visible=false.
Add a comment
Submit comment
Cancel
0
Sebastian
Telerik team
answered on
07 Mar 2009,
08:24 AM
Hi newbie,
Can you please check whether passing an empty data source for the grid produces the desired result for you:
C#
<GridInstance>.DataSource =
new
Object
[
0
]
;
VB.NET
<GridInstance>.DataSource =
new
Object
(){}
This should ensure that the NoRecords template/message will be displayed.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new
Telerik Support Portal
.
Check out the tips
for optimizing your support resource searches.
Add a comment
Submit comment
Cancel
Answer this question
Drag and drop files here or
browse
to attach...
Browse
for files to attach...
Supported file types: PNG, JPG, JPEG, ZIP, RAR, TXT. Max total file size - 20MB.
Submit answer
Cancel
Tags
Grid
Asked by
newbie
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
newbie
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or
Copy link