Detecting empty CheckBoxList without data

D

dbuchanan

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
 
S

Steven Cheng [MSFT]

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:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
S

Steven Cheng [MSFT]

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:
(e-mail address removed).

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

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

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top