473,503 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

repeater - show something when no results

Hi guys

How do I get a repeater to show a "sorry, no results found" message (within
the repeater) when I'm using DataBind?

Cheers
Dan
Nov 19 '05 #1
3 2507
You would need to check that from dataSource (or Repeater itself,
Items.Count being greater than 0), and render it out yourself somewhere say
into a Label. Repeater itself holds no template for this (but such is coming
into ASP.NET v2 though it is at least for GridView, can't remember now if
other controls have similar feature.)

--
Teemu Keiski
ASP.NET MVP, Finland

"dhnriverside" <da*@musoswire.com> wrote in message
news:51**********************************@microsof t.com...
Hi guys

How do I get a repeater to show a "sorry, no results found" message
(within
the repeater) when I'm using DataBind?

Cheers
Dan

Nov 19 '05 #2
if(datasource.Rows.Count == 0)
{
Repeater.Visible = false;
Label1.Visible = true;
Label1.Text = "Sorry, no results found.";
}
else
{
Repeater.Databind();
Repeater.Visible = true;
Label1.Visible = false;
}

Nov 19 '05 #3
Thanks guys... thats great cheers.

I'm gutted that it won't let me put it in the Repeater though - roll on BETA
2!!

Cheers
Dan

"Jason Bentley" wrote:
if(datasource.Rows.Count == 0)
{
Repeater.Visible = false;
Label1.Visible = true;
Label1.Text = "Sorry, no results found.";
}
else
{
Repeater.Databind();
Repeater.Visible = true;
Label1.Visible = false;
}

Nov 19 '05 #4

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

Similar topics

0
1146
by: 2003et | last post by:
Hi, I have a search system which shows results in REPEATER but, it shows, for example 80 data item once, but I want to show the results page by page in groups of 10. 1-10 11-20 21-30 ... etc....
2
2078
by: Mike Lerch | last post by:
I have data like this: Album Song Led Zeppelin I Good Times Bad Times Led Zeppelin I Babe I'm Gonna Leave You Led Zeppelin I You Shook Me Led Zeppelin I Dazed and Confused Led Zeppelin...
3
3236
by: m00nm0nkey | last post by:
I'm not sure if this is a good suggestion, or perhaps just my mis-understanding, but something that seems obviously missing from the ASP.Net Repeater control, is a "no results" template. What I...
3
4407
by: sorCrer | last post by:
Hi All, Posted after extensive searching! I have a nested repeater control as follows: (Simplified ;-)) <table> <asp:repeater id=parent onItemDataBound=createChild> <tr><td>Level...
8
4136
by: Matthew Curiale | last post by:
I am creating an app that lists clients of a company for management of different attributes for that company. The first page is a listing of the companies currently in the database. I have my...
1
1796
by: Steve Lutz | last post by:
I have written a web service to provide some back-end functionality to a Web Site. The web service returns lists of items. If I use the webservice via a browser, it works fine and returns the...
1
1988
by: Mike | last post by:
Hello all, Is there a way to change the ItemTemplate based on the data that is being shown? For instance, I have a dataset, contains two fields (NAME, STATE). I want to show all the records...
4
4885
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
11
4916
by: JJ297 | last post by:
I want to hide the Pin field below in my repeater. How do I do this? <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <tr> <td><font...
0
7207
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,...
0
7093
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...
0
7357
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...
0
7468
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...
0
5598
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,...
0
4690
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...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
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 ...
0
402
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...

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.