aspx页面<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %><!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>无标题页</title>
<style type="text/css">
.style1
{
border-style: none;
border-color: inherit;
border-width: 0px;
width: 100%;
margin: 0px;
height: 77px;
border: 0px;
}
</style>
</head>
<body style="margin: 0px">
<form id="form1" runat="server">
<div style="background-color: Green; height: auto; width: auto; visibility: collapse;">
<input id="Button1" type="button" value="button" /></div>
<div>
<table class="style1">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
.cs代码using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;namespace WebApplication2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
getBase(); }
}
private void getBase()
{
SqlConnection conn = new SqlConnection("server=.;database=northwind;uid=sa;pwd=sa");
try
{ conn.Open();
string sql = "select * from Employees";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds);
Response.Write("<table>");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Response.Write("<tr>");
for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
{
Response.Write("<td>");
Response.Write(ds.Tables[0].Rows[i][j].ToString());
Response.Write("</td>");
}
Response.Write("</tr>");
}
Response.Write("</table>");
}
catch (Exception)
{ throw;
}
finally
{
conn.Close();
}
}
}
}我想知道用JS如何实现对这个table数据的增删查改 - -太痛苦了 我需要看哪些技术知识
马上要做的项目就是纯html控件 包括数据绑定 等等 VS自带的不能用了
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<style type="text/css">
.style1
{
border-style: none;
border-color: inherit;
border-width: 0px;
width: 100%;
margin: 0px;
height: 77px;
border: 0px;
}
</style>
</head>
<body style="margin: 0px">
<form id="form1" runat="server">
<div style="background-color: Green; height: auto; width: auto; visibility: collapse;">
<input id="Button1" type="button" value="button" /></div>
<div>
<table class="style1">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
.cs代码using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;namespace WebApplication2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
getBase(); }
}
private void getBase()
{
SqlConnection conn = new SqlConnection("server=.;database=northwind;uid=sa;pwd=sa");
try
{ conn.Open();
string sql = "select * from Employees";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds);
Response.Write("<table>");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Response.Write("<tr>");
for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
{
Response.Write("<td>");
Response.Write(ds.Tables[0].Rows[i][j].ToString());
Response.Write("</td>");
}
Response.Write("</tr>");
}
Response.Write("</table>");
}
catch (Exception)
{ throw;
}
finally
{
conn.Close();
}
}
}
}我想知道用JS如何实现对这个table数据的增删查改 - -太痛苦了 我需要看哪些技术知识
马上要做的项目就是纯html控件 包括数据绑定 等等 VS自带的不能用了
纯HTML再用纯JS那开发速度得晕死。。可以学一下Jquery。下载一个Jquery文档。。或者买一本《锋利的Jquery》入门很好的书
学会把值post到后台 然后通过后台来处理