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

Posted by: Imar Spaanjaars at Saturday, February 12, 2005 9:09:07 PM in: ASP.NET 1.x
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 ...

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

Posted by: Imar Spaanjaars at Saturday, February 12, 2005 5:47:19 PM in: ASP.NET 1.x
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 ...

What do I need Protected WithEvents for?

Posted by: Peter Lanoie at Sunday, May 23, 2004 1:18:24 PM in: ASP.NET 1.x
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 ...

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

Posted by: Imar Spaanjaars at Thursday, May 06, 2004 2:59:29 PM in: ASP.NET 1.x

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 ...

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

Posted by: Peter Lanoie at Wednesday, April 14, 2004 8:52:52 PM in: ASP.NET 1.x
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 ...

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

Posted by: Peter Lanoie at Monday, April 12, 2004 8:23:26 PM in: ASP.NET 1.x
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 ... 1