Image representing the FAQs category

How Do I Determine if a Control Bound to a DataReader Has Rows?

Published 19 years ago

If you use .NET Data Binding to bind data from a data source (like a DataSet) to a control (like a DataGrid or Repeater) you often want to know if the control contains any rows. You can then use this knowledge to, for example, hide the entire DataGrid and display a message with the text "No records found" instead. You can easily accomplish this with a DataSet, because you can retrieve the number of items in the DataSet using something like myDataSet.Tables[0].Rows.Count. But what if you use a DataReader like the SqlDataReader? This class does not expose a count property.... Fortunately, there is a way to work around this.

Read on ...
Image representing the FAQs category

How Do I Add a Client Side Message Box to ASPX Pages?

Published 19 years ago

Update: 06/11/2006
Due to a number of requests I received, I have added a VB version of the code example in this article

In many applications, it's common practice to use a client side dialog, like a message box, to ask the user for confirmation or display a message. For example, if you allow a user to delete, say, an article on your site, you better ask if they are sure they want to delete the item. Many people know they can add a confirmation box to standard HTML or classic ASP pages. However, the same trick is less well known for ASPX pages, but just as possible and easy to implement. This FAQ will show you a few different scenario's for adding a confirmation dialog to your ASPX pages.

Read on ...
Image representing the FAQs category

What do I need Protected WithEvents for?

Published 19 years ago

I've noticed "Protected WithEvents" in the declarations for my controls on an ASPX web form. What's this all about? What does it mean?

Read on ...
Image representing the FAQs category

How Do I Add an Additional Item To a Databound DropDownList Control in ASP.NET?

Published 19 years ago

It's a common practice to bind some data to a DropDownList or ListBox control. The data for these controls can come from a wide variety of DataSources including Arrays, ArrayLists, HashTables and DataSets. Quite often, though, you'll have the need to add an additional item to the beginning of the list.

Read on ...
Image representing the FAQs category

How can I make a class variable accessible from different object instances of the same class?

Published 19 years ago

You may have the need to be able to access the same instance of a class variable from multiple object instances of that class. This is known as a "class" scope variable. Here I'll explain how it's done.

Read on ...
Image representing the FAQs category

How do I Handle Errors and Send an Error Notification from ASP.NET Applications?

Published 19 years ago

How do I set up my ASP.NET Web application to notify me with the details of an error when one occurs on my Web site? And how do I give the user a friendly message telling them an error has occurred?

Read on ...
  • «First
  • Previous
  • 1
  • Next
  • »Last

Mobile: False

Crawler: True

I: False