The Simplest CRUD Operations for Lookup Tables in ASP.NET
(Page 1 of 7 )
This article introduces you to implementing the fastest way to include CRUD operations for lookup tables in ASP.NET.
A downloadable file for this article is available
here.
The Design
In general, every application needs a few lookup tables. These lookup tables are also considered "system parameters" by many developers. It is not a hurdle at all to write CRUD (Create, Read, Update, Delete) operations using ASP.NET. But there exist too many methods for implementing these operations. In this article, I shall introduce you to the fastest template to include CRUD operations, which is very suitable for lookup tables.
In my sample, I actually worked with existing "flow" and "grid" layouts. It may not be suitable for certain browsers. If you want extreme browser compatibility, I suggest you to modify the screen design with HTML tables and panels.
My sample mainly contains a datagrid and a "server grid layout" control (with few buttons to operate). All of them have been pushed into a flow layout control for intelligent maintenance of space on the web page. The datagrid is equipped with two added columns as specified below:
<Columns>
<asp:ButtonColumn Text="<img border=0
src='images/icon_edit.gif'>" CommandName="OnEdit">
</asp:ButtonColumn>
<asp:ButtonColumn Text="<img border=0
src='images/icon_Delete.gif'>" CommandName="OnDel">
</asp:ButtonColumn>
</Columns>
From the above you can understand that I simply added two Button Columns to the data grid to work with "edit" and "delete" operations for the respective row. I am getting the connection string from the web.config using the following statement in the class SQLHelper.
Dim _ConnectionString As String =
System.Configuration.ConfigurationSettings.AppSettings.Get
("ConnectionString")
For this demonstration, I simply modified the following to the Web.config to maintain the database connection string:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString" value="Data Source=.;Initial
Catalog=Northwind;User Id=sa" />
</appSettings>
<system.web>
.
.
.
Next: The SQLHelper >>
More ASP.NET Articles
More By Jagadish Chaterjee