Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Repeater control--- what if there is no data?


Message #1 by "Oliver, Wells" <WOliver@l...> on Wed, 10 Jul 2002 11:35:28 -0700
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C22840.907686A0
Content-Type: text/plain;
	charset="iso-8859-1"

So I have a repeater control that loops through the contents of a query.

Question is-- what if there's no data? I want to give the user a message "No
records found!". What do you guys think is the best way to handle this? I
was thinking of a label control on the page and only giving it a value of
the query comes back empty.

Also, the Repeater control still draws the header & footer, even if there
are no items for the item template-- is there a way to customize (i.e. stop)
that?

Sorry for the constant traffic today-- just throwing ideas and questions out
there.

Thanks!

Wells Oliver
Web Application Programmer
Leviton Voice & Data
xxx-xxx-xxxx
http://www.levitonvoicedata.com 

Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Wed, 10 Jul 2002 15:17:51 -0400
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C22846.7C425960
Content-Type: text/plain;
	charset="iso-8859-1"

Didn't we already answer this one?
 
> So I have a repeater control that loops through the contents of a query.
 
Are you using a DataSet?  If so, set your label up and give it the "No
records found" text string by default.  Then, after you get your data into
your dataset:
 
noRecordsLabel.Visible 
(Convert.ToBool(ds.Tables["table"].Rows["column"].Count));
 
As for not displaying the header and footer, you're either going to have to
move up to a DataGrid to control that or, my personal favorite, SELECT *
FROM table FOR XML AUTO and put it through an Xml control on the page with a
nice XSLT report formatter (which you could use to display conditional
information if the record count < 0 and chances are you can re-use the same
XSLT for every table in your database if done correctly - and then you'd
only need one page to handle display where you'd pass the table name as the
only argument).
 
- Chuck

-----Original Message-----
From: Oliver, Wells [mailto:WOliver@l...]
Sent: Wednesday, July 10, 2002 2:35 PM
To: ASP+
Subject: [aspx] Repeater control--- what if there is no data?



So I have a repeater control that loops through the contents of a query. 

Question is-- what if there's no data? I want to give the user a message "No
records found!". What do you guys think is the best way to handle this? I
was thinking of a label control on the page and only giving it a value of
the query comes back empty.

Also, the Repeater control still draws the header & footer, even if there
are no items for the item template-- is there a way to customize (i.e. stop)
that?

Sorry for the constant traffic today-- just throwing ideas and questions out
there. 

Thanks! 

Wells Oliver 
Web Application Programmer 
Leviton Voice & Data 
xxx-xxx-xxxx 
http://www.levitonvoicedata.com <http://www.levitonvoicedata.com>  

--- Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to  



  Return to Index