首先是数据访问层的代码:
1
using System;
2
using System.Data;
3
using System.Data.SqlClient;
4
using System.Configuration;
5![](/Images/OutliningIndicators/None.gif)
6
namespace WebTest.Common
7
{
8
/// <summary>
9
/// COperator 的摘要说明。
10
/// </summary>
11
public class COperator
12
{
13
public COperator()
14
{
15
//
16
// TODO: 在此处添加构造函数逻辑
17
//
18
}
19
public DataSet HaveParameter(string StrProcedure)
20
{
21
SqlConnection MyConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionSqlServer"]);
22
SqlCommand MyCommand = new SqlCommand();
23
MyCommand.Connection = MyConnection;
24
MyCommand.CommandType = CommandType.StoredProcedure;
25
MyCommand.CommandText = StrProcedure;
26![](/Images/OutliningIndicators/InBlock.gif)
27![](/Images/OutliningIndicators/InBlock.gif)
28
SqlDataAdapter MyAdapter = new SqlDataAdapter();
29
30
MyAdapter.SelectCommand= MyCommand;
31![](/Images/OutliningIndicators/InBlock.gif)
32
DataSet Ds = new DataSet();
33![](/Images/OutliningIndicators/InBlock.gif)
34
if (MyConnection.State==System.Data.ConnectionState.Closed)
35
{
36
MyConnection.Open();
37
}
38
// 启动一个事务
39
SqlTransaction MyTrans = MyConnection.BeginTransaction();
40![](/Images/OutliningIndicators/InBlock.gif)
41
// initialize command object
42
MyCommand.Transaction = MyTrans;
43![](/Images/OutliningIndicators/InBlock.gif)
44
try
45
{
46
// 进行数据库操作
47
MyAdapter.Fill(Ds);
48
MyTrans.Commit();
49
}
50
catch
51
{
52
MyTrans.Rollback();
53
}
54
finally
55
{
56
MyConnection.Close();
57
}
58![](/Images/OutliningIndicators/InBlock.gif)
59
return Ds;
60
}
61![](/Images/OutliningIndicators/InBlock.gif)
62
public void NoReturnFunction(string StrParameter, string StrField, string StrProcedure)
63
{
64
// 创建数据库连接和命令的对象
65
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionSqlServer"]);
66
67
SqlCommand myCommand = new SqlCommand(StrProcedure, myConnection);
68![](/Images/OutliningIndicators/InBlock.gif)
69
// 指明Sql命令的操作类型是使用存储过程
70
myCommand.CommandType = CommandType.StoredProcedure;
71![](/Images/OutliningIndicators/InBlock.gif)
72
SqlParameter parameterStr = new SqlParameter(StrField, SqlDbType.VarChar, 500);
73
parameterStr.Value = StrParameter;
74
myCommand.Parameters.Add(parameterStr);
75![](/Images/OutliningIndicators/InBlock.gif)
76
// 打开数据库连接
77
if (myConnection.State==System.Data.ConnectionState.Closed)
78
{
79
myConnection.Open();
80
}
81![](/Images/OutliningIndicators/InBlock.gif)
82
// 启动一个事务
83
SqlTransaction MyTrans = myConnection.BeginTransaction();
84![](/Images/OutliningIndicators/InBlock.gif)
85
// initialize command object
86
myCommand.Transaction = MyTrans;
87![](/Images/OutliningIndicators/InBlock.gif)
88
try
89
{
90
// 进行数据库操作
91
myCommand.ExecuteNonQuery();
92
MyTrans.Commit();
93
}
94
catch
95
{
96
MyTrans.Rollback();
97
}
98
finally
99
{
100
// 关闭数据库连接
101
myConnection.Close();
102
}
103
}
104![](/Images/OutliningIndicators/InBlock.gif)
105
// 2参数
106
public void NoReturnFunction(string StrParameter1, string StrField1, string StrParameter2, string StrField2, string StrProcedure)
107
{
108
// 创建数据库连接和命令的对象
109
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionSqlServer"]);
110
111
SqlCommand myCommand = new SqlCommand(StrProcedure, myConnection);
112![](/Images/OutliningIndicators/InBlock.gif)
113
// 指明Sql命令的操作类型是使用存储过程
114
myCommand.CommandType = CommandType.StoredProcedure;
115![](/Images/OutliningIndicators/InBlock.gif)
116
SqlParameter parameterStr1 = new SqlParameter(StrField1, SqlDbType.NVarChar, 50);
117
parameterStr1.Value = StrParameter1;
118
myCommand.Parameters.Add(parameterStr1);
119![](/Images/OutliningIndicators/InBlock.gif)
120
SqlParameter parameterStr2 = new SqlParameter(StrField2, SqlDbType.NVarChar, 50);
121
parameterStr2.Value = StrParameter2;
122
myCommand.Parameters.Add(parameterStr2);
123![](/Images/OutliningIndicators/InBlock.gif)
124
// 打开数据库连接
125
if (myConnection.State==System.Data.ConnectionState.Closed)
126
{
127
myConnection.Open();
128
}
129![](/Images/OutliningIndicators/InBlock.gif)
130
// 启动一个事务
131
SqlTransaction MyTrans = myConnection.BeginTransaction();
132![](/Images/OutliningIndicators/InBlock.gif)
133
// initialize command object
134
myCommand.Transaction = MyTrans;
135![](/Images/OutliningIndicators/InBlock.gif)
136
try
137
{
138
// 进行数据库操作
139
myCommand.ExecuteNonQuery();
140
MyTrans.Commit();
141
}
142
catch
143
{
144
MyTrans.Rollback();
145
}
146
finally
147
{
148
// 关闭数据库连接
149
myConnection.Close();
150
}
151![](/Images/OutliningIndicators/InBlock.gif)
152
}
153
}
154
}
155![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
8
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
9
![](/Images/OutliningIndicators/InBlock.gif)
10
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
11
![](/Images/OutliningIndicators/InBlock.gif)
12
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
13
![](/Images/OutliningIndicators/InBlock.gif)
14
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
21
![](/Images/OutliningIndicators/InBlock.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/InBlock.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/InBlock.gif)
26
![](/Images/OutliningIndicators/InBlock.gif)
27
![](/Images/OutliningIndicators/InBlock.gif)
28
![](/Images/OutliningIndicators/InBlock.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/InBlock.gif)
31
![](/Images/OutliningIndicators/InBlock.gif)
32
![](/Images/OutliningIndicators/InBlock.gif)
33
![](/Images/OutliningIndicators/InBlock.gif)
34
![](/Images/OutliningIndicators/InBlock.gif)
35
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
36
![](/Images/OutliningIndicators/InBlock.gif)
37
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
38
![](/Images/OutliningIndicators/InBlock.gif)
39
![](/Images/OutliningIndicators/InBlock.gif)
40
![](/Images/OutliningIndicators/InBlock.gif)
41
![](/Images/OutliningIndicators/InBlock.gif)
42
![](/Images/OutliningIndicators/InBlock.gif)
43
![](/Images/OutliningIndicators/InBlock.gif)
44
![](/Images/OutliningIndicators/InBlock.gif)
45
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
46
![](/Images/OutliningIndicators/InBlock.gif)
47
![](/Images/OutliningIndicators/InBlock.gif)
48
![](/Images/OutliningIndicators/InBlock.gif)
49
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
50
![](/Images/OutliningIndicators/InBlock.gif)
51
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
52
![](/Images/OutliningIndicators/InBlock.gif)
53
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
54
![](/Images/OutliningIndicators/InBlock.gif)
55
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
56
![](/Images/OutliningIndicators/InBlock.gif)
57
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
58
![](/Images/OutliningIndicators/InBlock.gif)
59
![](/Images/OutliningIndicators/InBlock.gif)
60
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
61
![](/Images/OutliningIndicators/InBlock.gif)
62
![](/Images/OutliningIndicators/InBlock.gif)
63
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
64
![](/Images/OutliningIndicators/InBlock.gif)
65
![](/Images/OutliningIndicators/InBlock.gif)
66
![](/Images/OutliningIndicators/InBlock.gif)
67
![](/Images/OutliningIndicators/InBlock.gif)
68
![](/Images/OutliningIndicators/InBlock.gif)
69
![](/Images/OutliningIndicators/InBlock.gif)
70
![](/Images/OutliningIndicators/InBlock.gif)
71
![](/Images/OutliningIndicators/InBlock.gif)
72
![](/Images/OutliningIndicators/InBlock.gif)
73
![](/Images/OutliningIndicators/InBlock.gif)
74
![](/Images/OutliningIndicators/InBlock.gif)
75
![](/Images/OutliningIndicators/InBlock.gif)
76
![](/Images/OutliningIndicators/InBlock.gif)
77
![](/Images/OutliningIndicators/InBlock.gif)
78
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
79
![](/Images/OutliningIndicators/InBlock.gif)
80
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
81
![](/Images/OutliningIndicators/InBlock.gif)
82
![](/Images/OutliningIndicators/InBlock.gif)
83
![](/Images/OutliningIndicators/InBlock.gif)
84
![](/Images/OutliningIndicators/InBlock.gif)
85
![](/Images/OutliningIndicators/InBlock.gif)
86
![](/Images/OutliningIndicators/InBlock.gif)
87
![](/Images/OutliningIndicators/InBlock.gif)
88
![](/Images/OutliningIndicators/InBlock.gif)
89
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
90
![](/Images/OutliningIndicators/InBlock.gif)
91
![](/Images/OutliningIndicators/InBlock.gif)
92
![](/Images/OutliningIndicators/InBlock.gif)
93
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
94
![](/Images/OutliningIndicators/InBlock.gif)
95
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
96
![](/Images/OutliningIndicators/InBlock.gif)
97
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
98
![](/Images/OutliningIndicators/InBlock.gif)
99
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
100
![](/Images/OutliningIndicators/InBlock.gif)
101
![](/Images/OutliningIndicators/InBlock.gif)
102
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
103
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
104
![](/Images/OutliningIndicators/InBlock.gif)
105
![](/Images/OutliningIndicators/InBlock.gif)
106
![](/Images/OutliningIndicators/InBlock.gif)
107
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
108
![](/Images/OutliningIndicators/InBlock.gif)
109
![](/Images/OutliningIndicators/InBlock.gif)
110
![](/Images/OutliningIndicators/InBlock.gif)
111
![](/Images/OutliningIndicators/InBlock.gif)
112
![](/Images/OutliningIndicators/InBlock.gif)
113
![](/Images/OutliningIndicators/InBlock.gif)
114
![](/Images/OutliningIndicators/InBlock.gif)
115
![](/Images/OutliningIndicators/InBlock.gif)
116
![](/Images/OutliningIndicators/InBlock.gif)
117
![](/Images/OutliningIndicators/InBlock.gif)
118
![](/Images/OutliningIndicators/InBlock.gif)
119
![](/Images/OutliningIndicators/InBlock.gif)
120
![](/Images/OutliningIndicators/InBlock.gif)
121
![](/Images/OutliningIndicators/InBlock.gif)
122
![](/Images/OutliningIndicators/InBlock.gif)
123
![](/Images/OutliningIndicators/InBlock.gif)
124
![](/Images/OutliningIndicators/InBlock.gif)
125
![](/Images/OutliningIndicators/InBlock.gif)
126
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
127
![](/Images/OutliningIndicators/InBlock.gif)
128
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
129
![](/Images/OutliningIndicators/InBlock.gif)
130
![](/Images/OutliningIndicators/InBlock.gif)
131
![](/Images/OutliningIndicators/InBlock.gif)
132
![](/Images/OutliningIndicators/InBlock.gif)
133
![](/Images/OutliningIndicators/InBlock.gif)
134
![](/Images/OutliningIndicators/InBlock.gif)
135
![](/Images/OutliningIndicators/InBlock.gif)
136
![](/Images/OutliningIndicators/InBlock.gif)
137
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
138
![](/Images/OutliningIndicators/InBlock.gif)
139
![](/Images/OutliningIndicators/InBlock.gif)
140
![](/Images/OutliningIndicators/InBlock.gif)
141
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
142
![](/Images/OutliningIndicators/InBlock.gif)
143
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
144
![](/Images/OutliningIndicators/InBlock.gif)
145
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
146
![](/Images/OutliningIndicators/InBlock.gif)
147
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
148
![](/Images/OutliningIndicators/InBlock.gif)
149
![](/Images/OutliningIndicators/InBlock.gif)
150
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
151
![](/Images/OutliningIndicators/InBlock.gif)
152
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
153
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
154
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
155
![](/Images/OutliningIndicators/None.gif)
Add:
1
using System;
2
using System.Collections;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Web;
7
using System.Web.SessionState;
8
using System.Web.UI;
9
using System.Web.UI.WebControls;
10
using System.Web.UI.HtmlControls;
11![](/Images/OutliningIndicators/None.gif)
12
namespace WebTest
13
{
14
/// <summary>
15
/// AddInfo 的摘要说明。
16
/// </summary>
17
public class AddInfo : System.Web.UI.Page
18
{
19
protected System.Web.UI.WebControls.Button BtOk;
20
protected System.Web.UI.WebControls.TextBox TextBox1;
21
22
private void Page_Load(object sender, System.EventArgs e)
23
{
24
// 在此处放置用户代码以初始化页面
25
}
26![](/Images/OutliningIndicators/InBlock.gif)
27
Web 窗体设计器生成的代码
48![](/Images/OutliningIndicators/InBlock.gif)
49
private void BtOk_Click(object sender, System.EventArgs e)
50
{
51
WebTest.Common.COperator AddObj = new WebTest.Common.COperator();
52
AddObj.NoReturnFunction(TextBox1.Text, "@StrTValues", "TS_AddValuesIntoTb");
53
}
54![](/Images/OutliningIndicators/InBlock.gif)
55
}
56
}
57![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
14
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/InBlock.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
26
![](/Images/OutliningIndicators/InBlock.gif)
27
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
48
![](/Images/OutliningIndicators/InBlock.gif)
49
![](/Images/OutliningIndicators/InBlock.gif)
50
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
51
![](/Images/OutliningIndicators/InBlock.gif)
52
![](/Images/OutliningIndicators/InBlock.gif)
53
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
54
![](/Images/OutliningIndicators/InBlock.gif)
55
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
56
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
57
![](/Images/OutliningIndicators/None.gif)
Edit/Delete with DataGrid:
1
using System;
2
using System.Collections;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Web;
7
using System.Web.SessionState;
8
using System.Web.UI;
9
using System.Web.UI.WebControls;
10
using System.Web.UI.HtmlControls;
11![](/Images/OutliningIndicators/None.gif)
12
namespace WebTest
13
{
14
/// <summary>
15
/// _Default 的摘要说明。
16
/// </summary>
17
public class _Default : System.Web.UI.Page
18
{
19
protected System.Web.UI.WebControls.DataGrid DataGrid1;
20
21
private void Page_Load(object sender, System.EventArgs e)
22
{
23
// 在此处放置用户代码以初始化页面
24
if (!IsPostBack)
25
{
26
MyDataBind();
27
}
28
}
29![](/Images/OutliningIndicators/InBlock.gif)
30
Web 窗体设计器生成的代码
53![](/Images/OutliningIndicators/InBlock.gif)
54
private void MyDataBind()
55
{
56
WebTest.Common.COperator ShowObj = new WebTest.Common.COperator();
57
DataGrid1.DataSource = ShowObj.HaveParameter("SearchAllInfoFromTb");
58
DataGrid1.DataBind();
59
}
60![](/Images/OutliningIndicators/InBlock.gif)
61
public void BtEdit(object sender, System.Web.UI.WebControls.CommandEventArgs e)
62
{
63
string Str = e.CommandArgument.ToString();
64
// Response.Write("<script>alert('xx')</script>");
65
Response.Write(Str);
66
}
67![](/Images/OutliningIndicators/InBlock.gif)
68
public void BtDelete(object sender, System.Web.UI.WebControls.CommandEventArgs e)
69
{
70
WebTest.Common.COperator DeleteObj = new WebTest.Common.COperator();
71
DeleteObj.NoReturnFunction(e.CommandArgument.ToString(), "@StrID", "TS_DeleteInfoFromTb");
72
MyDataBind();
73
}
74![](/Images/OutliningIndicators/InBlock.gif)
75
private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
76
{
77
DataGrid1.EditItemIndex = e.Item.ItemIndex;
78
MyDataBind();
79
}
80![](/Images/OutliningIndicators/InBlock.gif)
81
private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
82
{
83
DataGrid1.EditItemIndex = -1;
84
MyDataBind();
85
}
86![](/Images/OutliningIndicators/InBlock.gif)
87
private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
88
{
89
TextBox MyTb = (TextBox)e.Item.FindControl("TextBox1");
90
Label MyLb = (Label)e.Item.FindControl("LbID");
91
// int IntT = (int)DataGrid1.DataKeyField[e.Item.ItemIndex];
92
WebTest.Common.COperator UpdateObj = new WebTest.Common.COperator();
93
UpdateObj.NoReturnFunction(MyLb.Text, "@StrTID", MyTb.Text, "@StrTValues", "TS_UpdateTb");
94![](/Images/OutliningIndicators/InBlock.gif)
95
DataGrid1.EditItemIndex = -1;
96
MyDataBind();
97
}
98![](/Images/OutliningIndicators/InBlock.gif)
99
public void DataGrid1_OnPageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
100
{
101
//设置当前页的索引
102
DataGrid1.CurrentPageIndex = e.NewPageIndex;
103
//重新进行数据绑定
104
MyDataBind();
105
}
106
}
107
}
108![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
14
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/InBlock.gif)
22
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
23
![](/Images/OutliningIndicators/InBlock.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
26
![](/Images/OutliningIndicators/InBlock.gif)
27
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
28
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
53
![](/Images/OutliningIndicators/InBlock.gif)
54
![](/Images/OutliningIndicators/InBlock.gif)
55
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
56
![](/Images/OutliningIndicators/InBlock.gif)
57
![](/Images/OutliningIndicators/InBlock.gif)
58
![](/Images/OutliningIndicators/InBlock.gif)
59
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
60
![](/Images/OutliningIndicators/InBlock.gif)
61
![](/Images/OutliningIndicators/InBlock.gif)
62
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
63
![](/Images/OutliningIndicators/InBlock.gif)
64
![](/Images/OutliningIndicators/InBlock.gif)
65
![](/Images/OutliningIndicators/InBlock.gif)
66
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
67
![](/Images/OutliningIndicators/InBlock.gif)
68
![](/Images/OutliningIndicators/InBlock.gif)
69
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
70
![](/Images/OutliningIndicators/InBlock.gif)
71
![](/Images/OutliningIndicators/InBlock.gif)
72
![](/Images/OutliningIndicators/InBlock.gif)
73
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
74
![](/Images/OutliningIndicators/InBlock.gif)
75
![](/Images/OutliningIndicators/InBlock.gif)
76
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
77
![](/Images/OutliningIndicators/InBlock.gif)
78
![](/Images/OutliningIndicators/InBlock.gif)
79
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
80
![](/Images/OutliningIndicators/InBlock.gif)
81
![](/Images/OutliningIndicators/InBlock.gif)
82
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
83
![](/Images/OutliningIndicators/InBlock.gif)
84
![](/Images/OutliningIndicators/InBlock.gif)
85
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
86
![](/Images/OutliningIndicators/InBlock.gif)
87
![](/Images/OutliningIndicators/InBlock.gif)
88
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
89
![](/Images/OutliningIndicators/InBlock.gif)
90
![](/Images/OutliningIndicators/InBlock.gif)
91
![](/Images/OutliningIndicators/InBlock.gif)
92
![](/Images/OutliningIndicators/InBlock.gif)
93
![](/Images/OutliningIndicators/InBlock.gif)
94
![](/Images/OutliningIndicators/InBlock.gif)
95
![](/Images/OutliningIndicators/InBlock.gif)
96
![](/Images/OutliningIndicators/InBlock.gif)
97
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
98
![](/Images/OutliningIndicators/InBlock.gif)
99
![](/Images/OutliningIndicators/InBlock.gif)
100
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
101
![](/Images/OutliningIndicators/InBlock.gif)
102
![](/Images/OutliningIndicators/InBlock.gif)
103
![](/Images/OutliningIndicators/InBlock.gif)
104
![](/Images/OutliningIndicators/InBlock.gif)
105
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
106
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
107
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
108
![](/Images/OutliningIndicators/None.gif)
html:
1
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="WebTest._Default" %>
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
3
<HTML>
4
<HEAD>
5
<title>Default</title>
6
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
7
<meta content="C#" name="CODE_LANGUAGE">
8
<meta content="JavaScript" name="vs_defaultClientScript">
9
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
10
</HEAD>
11
<body MS_POSITIONING="GridLayout">
12
<form id="Form1" method="post" runat="server">
13
<FONT face="宋体">
14
<asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 256px; POSITION: absolute; TOP: 88px"
15
runat="server" OnPageIndexChanged="DataGrid1_OnPageIndexChanged" AutoGenerateColumns="False"
16
DataKeyField="TID" PageSize="5" AllowPaging="True">
17
<Columns>
18
<asp:TemplateColumn HeaderText="ID">
19
<ItemTemplate>
20
<asp:Label id=LbID runat="server" text='<%# DataBinder.Eval(Container.DataItem, "TID") %>'>
21
</asp:Label>
22
</ItemTemplate>
23
</asp:TemplateColumn>
24
<asp:TemplateColumn HeaderText="Values">
25
<ItemTemplate>
26
<asp:Label id=LbValues runat="server" text='<%# DataBinder.Eval(Container.DataItem, "TValues") %>'>
27
</asp:Label>
28
</ItemTemplate>
29
<EditItemTemplate>
30
<asp:TextBox id=TextBox1 runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "TValues") %>' Width="64px">
31
</asp:TextBox>
32
</EditItemTemplate>
33
</asp:TemplateColumn>
34
<asp:EditCommandColumn ButtonType="PushButton" UpdateText="更新" HeaderText="编辑" CancelText="取消" EditText="编辑"></asp:EditCommandColumn>
35
<asp:TemplateColumn HeaderText="删除">
36
<ItemTemplate>
37
<asp:Button id="BtDelete" runat="server" Text="删除" CommandArgument = '<%# DataBinder.Eval(Container.DataItem, "TID") %>' OnCommand = "BtDelete">
38
</asp:Button>
39
</ItemTemplate>
40
</asp:TemplateColumn>
41
</Columns>
42
<PagerStyle HorizontalAlign="Right" Mode="NumericPages"></PagerStyle>
43
</asp:datagrid></FONT></form>
44
</body>
45
</HTML>
46![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/None.gif)
15
![](/Images/OutliningIndicators/None.gif)
16
![](/Images/OutliningIndicators/None.gif)
17
![](/Images/OutliningIndicators/None.gif)
18
![](/Images/OutliningIndicators/None.gif)
19
![](/Images/OutliningIndicators/None.gif)
20
![](/Images/OutliningIndicators/None.gif)
21
![](/Images/OutliningIndicators/None.gif)
22
![](/Images/OutliningIndicators/None.gif)
23
![](/Images/OutliningIndicators/None.gif)
24
![](/Images/OutliningIndicators/None.gif)
25
![](/Images/OutliningIndicators/None.gif)
26
![](/Images/OutliningIndicators/None.gif)
27
![](/Images/OutliningIndicators/None.gif)
28
![](/Images/OutliningIndicators/None.gif)
29
![](/Images/OutliningIndicators/None.gif)
30
![](/Images/OutliningIndicators/None.gif)
31
![](/Images/OutliningIndicators/None.gif)
32
![](/Images/OutliningIndicators/None.gif)
33
![](/Images/OutliningIndicators/None.gif)
34
![](/Images/OutliningIndicators/None.gif)
35
![](/Images/OutliningIndicators/None.gif)
36
![](/Images/OutliningIndicators/None.gif)
37
![](/Images/OutliningIndicators/None.gif)
38
![](/Images/OutliningIndicators/None.gif)
39
![](/Images/OutliningIndicators/None.gif)
40
![](/Images/OutliningIndicators/None.gif)
41
![](/Images/OutliningIndicators/None.gif)
42
![](/Images/OutliningIndicators/None.gif)
43
![](/Images/OutliningIndicators/None.gif)
44
![](/Images/OutliningIndicators/None.gif)
45
![](/Images/OutliningIndicators/None.gif)
46
![](/Images/OutliningIndicators/None.gif)