Product Bundles
DevCraft
All Telerik .NET and Kendo UI JavaScript components and AI Tools in one package.
Kendo UI
Bundle of AI Tools plus four JavaScript UI libraries built natively for jQuery, Angular, React and Vue.
Build JavaScript UI
Javascript
Telerik
Build modern .NET business apps
.Net Web
Cross-Platform
Desktop
Reporting and Documents
AI for Developers & IT
Ensure AI program success
AI Coding
AI Engineering
Additional Tools
Enhance the developer and designer experience
Testing & Mocking
Debugging
AI-Enhanced UI Tools
CMS
Free Tools
Support and Learning
Productivity and Design Tools
protected
void
RadImageGallery1_DataBound(
object
sender, EventArgs e)
{
SqlConnection connection=
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"NorthwindConnectionString"
].ConnectionString);
connection.Open();
SqlCommand cmd =
SqlCommand(
"SELECT COUNT(*) FROM Images"
, cn);
Int32 count = (Int32)cmd.ExecuteScalar();
if
(count == 0)
RadImageGallery1.Visible =
false
;
connection.close();
}
Hi Marty,
You can databind the control manually - perform a Select() to see what the result is: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.select(v=vs.110).aspx. If there is data - set the collection you have to the DataSource property and call the DataBind() method. Otherwise, set the Visible property to false.
You can also use the Selecting SqlDataSource event to see this information, as discussed in numerous placed in the net, e.g.: http://stackoverflow.com/questions/2231273/how-do-i-check-that-a-sqldatasource-returned-data. Regards,
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.