Databinding a GridView in C# with ADO.NET

Something simple, you want to use ADO.NET to bind data from SQL Server to a GridView, here is your code behind [codesyntax lang=”csharp”] using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using...

How to store and retrieve information using web.config

So you like the idea of storing variables centrally, and want to know how to implement that in your c# web site. Simply add the following node to your web.config if it does not already exist [codesyntax lang=”xml”] <configuration> <appSettings>...

Programatically building an HTML table in C#

These are the minimum using directives to add at the top of the code behind for building an HTML table from a SQL Server to a SqlDataReader concisely. [codesyntax lang=”csharp”] using System.Web.UI.HtmlControls; using System.Data; using...

Databound DropDownList in C#

Remember to add the usual using directives at the start of the codebehind [codesyntax lang=”csharp”] using System.Data; using System.Data.SqlClient; [/codesyntax] For a DropDownList on your ASP.NET page with an ID of Category such a [codesyntax...