473,378 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Determine number of rows in Repeater?

I'm filling a Repeater control based on a SELECT statement. If the SELECT
statement returns 0 rows, then I want to hide the entire Repeater control.
Currently I'm doing this:

SqlCommand cmd = new SqlCommand("SELECT * FROM whatever where whatever",
conn);

myRepeater1.DataSource =
cmd.ExecuteReader(CommandBehavior.CloseConnection) ;

So what I'm looking for is now to do this:

if (something == true)

myRepeater1.visible = false;

However I cannot figure ouw what the "something" is above in the IF
statement. What could I use there to either determine that the SQL SELECT
statement returned 0 rows or that the Repeater contained no nows so that I
can dynamically hide the entire repeater includng its header and footer?

Thanks!
Oct 22 '06 #1
1 1374
"Mike Cain" <aa@aa.comwrote in message
news:6P******************************@comcast.com. ..

SqlDataReader objDataReader =
cmd.ExecuteReader(CommandBehavior.CloseConnection) ;
if (!objDataReader.HasRows)
{
myRepeater1.Visible = false;
}
else
{
myRepeater1.DataSource = objDataReader;
}
Oct 22 '06 #2

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

Similar topics

4
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....
1
by: Viktor Popov | last post by:
Hi, I have the following problem. I read from a text file and than I would like to show what I read in a Repeater control using this function: ArrayList Words = new ArrayList(); StreamReader sr...
3
by: BBFrost | last post by:
Ok, I know how to count the number of selected datagrid rows using the code below. What has me stumped is how to determine when the selected rows within a datagrid have been changed. The...
2
by: Erik Cruz | last post by:
Hi. I have a repeater control bound to an ArrayList. When displaying the data, I need to show 3 columns per row, each column being one entry of my ArrayList, but the repeater understands that...
3
by: TomislaW | last post by:
I need to show 5 rows and put link for more.. where and how to put this limit? on item data bound or else?
2
by: Mike Kelly | last post by:
Hi. I have a data table where rows are grouped according to a certain criteria and I want to be able to display all the rows that belong to the same group together on the screen. In addition, I...
3
by: renil | last post by:
I have a repeater control that displays info. from a datatable. Each row in the repeater has a checkbox. Also, I have a delete linkbutton outside the repeater control. What I'm trying to do when...
1
by: DotNetDev | last post by:
I have a datarepeater. <asp:Repeater id="_quiestionsDataRepeater" runat="server"> <ItemTemplate> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> <asp:Label id="Label2"...
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.