Click here to Skip to main content
15,885,757 members
Articles / Web Development / ASP.NET

ASP.NET Web Component for editing SQL tables

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
29 Nov 2012CPOL11 min read 42.9K   2.5K   24  
ASP.NET c# component for editing SQL tables with plug-in column format adapter architecture.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EditTableDemo.Default" %>
<%@ Register assembly="EditTable" namespace="BFCS.Data.Common" tagprefix="data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Edit Table Demo</title>
    <style type="text/css">
.table
{
	border: solid 1px black;
	font-family: Arial, Sans-Serif;
	font-weight: normal;
	font-size: small;
	padding: 5px;
	
}
.th
{
	color: Black;
	background-color: Aqua;
	border: solid 1px black;
	padding: 5px;
}
.thk
{
	color: Black;
	background-color: Aqua;
	border: solid 1px black;
	font-weight: bold;
	font-style: italic;
	padding: 5px;
}
.td
{
	padding: 5px;
	color: Black;
	background-color: White;
	border: solid 1px black;
}
.tds
{
	color: Black;
	background-color: Gray;
	border: solid 1px black;
	padding: 5px;
}
.tdsError
{
	color: Black;
	background-color: Red;
	border: solid 1px black;
	padding: 5px;
}
    </style>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table cellpadding="10">
 <tr><td>
         <asp:Label ID="Label1" runat="server" Font-Names="Ariel,Sans-Serif" Text="Select Table To Edit" 
             Font-Italic="True"></asp:Label>
 </td></tr>
 <tr><td>
     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
         
             style="height: 22px; width: 254px" 
             onselectedindexchanged="DropDownList1_SelectedIndexChanged">
         <asp:ListItem>-- Select Table --</asp:ListItem>
         <asp:ListItem Value="Calendar">Event Calendar</asp:ListItem>
         <asp:ListItem Value="Message">Message Log</asp:ListItem>
         <asp:ListItem Value="MessageCategory">Message Categories</asp:ListItem>
         <asp:ListItem Value="Settings">Settings</asp:ListItem>
     </asp:DropDownList>
 </td></tr>
 <tr><td>
    <data:EditTable ID="EditTable1" runat="server" RowsPerPage="12" BorderStyle="None" 
        FooterClass="th" HeadlineClass="th" 
        ItemClass="td" style="width: 700px;" 
        TableClass="table" Visible="False" onerror_changed="EditTable1_Error_Changed" 
             SelectedClass="tds" KeyHeadlineClass="thk" ErrorClass="tdsError" CellSpacing="0">
    </data:EditTable>
 </td></tr>
 <tr><td>
<asp:Label ID="lblError" runat="server" Font-Names="Ariel,Sans-Serif" Text="Error" 
             Font-Bold="True" ForeColor="Red" Visible="False"></asp:Label>    
 </td></tr>
 <tr><td>
         <asp:Label ID="lblLog" runat="server" Visible="False"></asp:Label>
 </td></tr>
 </table>
    
    </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Rovenet, Inc.
United States United States
Bill, who thinks of himself in the third person, has been programming since the dawn of time (1974) in a wide variety of hardware environments (dipswitch settings and paper tape in the beginning), languages (asm, forth, c, c++, c#, basic [visual and unvisualizable]) and industries (graphic arts, medical technology, commercial, website, mobile devices). Corporate clients include DHL, Pitney-Bowes and now-defunct medical equipment midget Q-Med. In his free time, which is all the time, he plays bluegrass guitar, body-boards the oceans of the world and bicycles through Southern California and eastern Long Island, NY.

Comments and Discussions