Category Archives: C#

After inserting a record in a DetailsView control, set the master GridView control to the newly inserted record’s ID (identity)

The problem

I’m learning how to build ASP.NET websites in C# using Microsoft Visual Studio 2005. Everything about this is new to me. I have done a lot of work building HTML websites, quite a bit of javascript, and a little php and MySQL development. But now everything I know amounts to nothing as I try to learn a new development environment (Visual Studio), and two new programming languages (C# and ASP.NET). It’s an interesting process, and I rather enjoy what I’m learning, but I wanted to make it clear right up front that the advice included in this post may not be the best advice you can find: I still have a lot to learn!

That being said, let me describe one of the first problems I encountered in my new programming scenario:

I am building a website to allow users to add, edit, and delete items in a list of events. I am using an ASP.NET/Visual Studio MultiView control to manage the process flow for selecting and editing the events. The first view that the user sees is a GridView control displaying the complete list of events in the database.

Read more»