472,351 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Detecting empty CheckBoxList without data

How, at rundime, do I capture the fact that the parametrized query that
fills a CheckBoxList results in an empty set. When the dataset is empty the
CheckBoxList does not appear. I would like to properly inform the user of
the fact.

How is ths done?

Thank you,
Doug
Jun 27 '08 #1
3 2648
Hi Doug,

Is this issue and continous one from the previous checkbox list query one?
I think you've now be able to query the data based on the checkboxlist's
selection status, and your current difficulty is how to do some
customization on the page depend on whether the returened query result is
empty or not, correct?

If this is the case, would you show me the code on how to query the result
and how to bind it to the databound control(DataGrid or Gridview) or are
you still using a SqlDataSource control?

If you are programmtically call ADO.NET SqlCommand or TableAdapdter to get
the DataSet, I think you can set the CheckBoxList.Visible to false in your
code after check whether the returned DataTable is empty.

If you're using SqlDataSource control, I think you may register its
"Selected" event, and use the "AffectedRows" parameter propertyto determine
whether there is any row get returned. e.g.

===============
protected void SqlDataSource1_Selected(object sender,
SqlDataSourceStatusEventArgs e)
{
Response.Write("<br/>AffectedRows: " + e.AffectedRows);
}
=================

If there is anything I have omited or if you have any parituclar
requirement, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "dbuchanan" <db*******@newsgroup.nospam>
Subject: Detecting empty CheckBoxList without data
Date: Thu, 12 Jun 2008 01:12:38 -0400
>
How, at rundime, do I capture the fact that the parametrized query that
fills a CheckBoxList results in an empty set. When the dataset is empty
the
>CheckBoxList does not appear. I would like to properly inform the user of
the fact.

How is ths done?

Thank you,
Doug
Jun 27 '08 #2
Thank you Steve this works great.

Doug
Jun 27 '08 #3
You're welcome Doug,

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "dbuchanan" <db*******@newsgroup.nospam>
References: <#2**************@TK2MSFTNGP04.phx.gbl>
<i9**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Detecting empty CheckBoxList without data
Date: Fri, 13 Jun 2008 14:55:58 -0400

Thank you Steve this works great.

Doug
Jun 27 '08 #4

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

Similar topics

5
by: Jole | last post by:
Hi I'm writing a program that needs to read from a file. In order for the program to be robust, it should somehow check that the file isn't...
0
by: rob | last post by:
Here is my scenario: One of my aspx pages has a CheckBoxList (Item1, Item2) and a GridView. Then I have a database that has the columns Item1 and...
0
by: Bryce Budd | last post by:
Hello All, I've been a taker of information from newsgroups for a long time and thought I'd finally make a contribution back to the community...
9
by: D. Shane Fowlkes | last post by:
I'm using SQL Server 2000 and on my page, I'm simply creating a SQLDataReader and filling in Labels with the retrieved (single) record. However,...
3
by: I am Sam | last post by:
I keep getting the following error message when I try to iterate through a CheckBoxList control: Object reference not set to an instance of an...
2
by: Patrick.O.Ige | last post by:
I have some boolean value(1 or 0 ) in a table and i want a databinded CheckBoxList to present the selected values on the page.. With CheckBox i...
2
by: EnjoyLife | last post by:
I am new to ASP.NET and am trying to learn it the best that I can. I am trying to add some code in the If IntRowIndex > -1 statement to mark an item...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
6
by: Bishop | last post by:
I'm trying to find out how to populate a CheckBoxList from code without using a database. The following code generates 6 unchecked checkboxes...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.