By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,473 Members | 3,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,473 IT Pros & Developers. It's quick & easy.

Detecting empty CheckBoxList without data

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
Thank you Steve this works great.

Doug
Jun 27 '08 #3

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.