If you have a Gridview that exports rows to Excel (see my article Gridview that exports selected rows to Excel for an example) and you are using Master Pages, you are likely to run into the following error: "Control 'ctl00_MainContent_Gridview1' of type 'GridView' must be placed inside a form ... [More]
I recently had a project where I needed to provide a Gridview of items that the customer could individually select and export to Excel.  The solution worked really well, so here it is for all to enjoy... This seems like a messy workaround, but I ended up using two Gridviews - one to display ... [More]
When you bind a dropdownlist to a table of data, and you try to edit an entry that contains data that has been deleted, you invariably will run into the error: 'dropdownlist1' has a SelectedValue which is invalid because it does not exist in the list of items. Consider the following example: You... [More]
Matt Berseth (http://www.mattberseth.com/) has some of the best ASP.NET 2.0 articles around, and his examples are always well documented. Matt recently wrote some articles about how to a design good looking Gridview's (Building a vs2008 Styled Grid and Gridview Themes based on Google's Personalize... [More]
I ran into a frustrating error recently, where my compare validator was refusing to co-operate when testing 2 dates. Here is my code: Start date: <asp:TextBox runat="server" ID="txtStartDate" Width="80px" CssClass="TextField" Text='<%# Bind(&q... [More]
This is a simple example for how to provide an editing interface for date and time fields.  Say that you are storing Booking details and your BookingDate field contains both the date and time, eg '21/05/2008 10:30:00 AM' If you wanted to display the date and time strings seperately you can ... [More]
When I first started programming in ASP.NET, the Formview was indispensable in displaying and manipulating data.  Eventually though, I needed access to individual fields within the Formview, and that's when I found many examples showing how to access field data  using the Ctype syntax to r... [More]