zoukankan
html css js c++ java
Gridview 添加行.
Code
1
private
DataTable ReadGridView()
2
{
3
DataTable newDataTable
=
new
DataTable(
"
Table1
"
);
4
5
newDataTable
=
CreateTable();
6
7
8
for
(
int
i
=
0
; i
<
this
.gv_productlist.Rows.Count; i
++
)
9
{
10
GridViewRow gRow
=
gv_productlist.Rows[i];
11
DataRow newrow
=
newDataTable.NewRow();
12
//
newRow[""] = L_ModelType
13
newrow[
"
ProjectGuid
"
]
=
L_guidvalue.Text;
14
newrow[
"
ProdGuid
"
]
=
((Label)gRow.FindControl(
"
L_prodguid
"
)).Text;
15
newrow[
"
fldNum
"
]
=
((TextBox)gRow.FindControl(
"
txt_fldnum
"
)).Text;
16
newrow[
"
fldEndDate
"
]
=
((Label)gRow.FindControl(
"
L_EndDate
"
)).Text; ; ;
17
newrow[
"
fldModelType
"
]
=
((Label)gRow.FindControl(
"
L_ModelType
"
)).Text;
18
newrow[
"
fldModelTypeSj
"
]
=
((TextBox)gRow.FindControl(
"
txt_fldModelTypeSj
"
)).Text;
19
newrow[
"
ID
"
]
=
((Label)gRow.FindControl(
"
L_NO
"
)).Text;
20
newDataTable.Rows.Add(newrow);
21
}
22
newDataTable.AcceptChanges();
23
return
newDataTable;
24
25
}
26
Code
1
2
public
void
BindList()
3
{
4
//
DataTable table = CreateTable();
5
6
DataTable sTable
=
new
DataTable();
7
sTable
=
ReadGridView();
8
if
(id
==
0
)
9
{
10
if
(Session[L_guidvalue.Text.Trim()]
!=
null
)
11
{
12
DataTable tb
=
new
DataTable();
13
tb
=
Session[L_guidvalue.Text.Trim()]
as
DataTable;
14
//
table = Session[L_guidvalue.Text.Trim()] as DataTable;
15
for
(
int
i
=
0
; i
<
tb.Rows.Count; i
++
)
16
{
17
sTable.ImportRow(tb.Rows[i]);
18
}
19
}
20
}
21
else
22
{
23
//
如果有session则里面读取
24
if
(Session[L_guidvalue.Text.Trim()]
!=
null
)
25
{
26
DataTable tb
=
new
DataTable();
27
tb
=
Session[L_guidvalue.Text.Trim()]
as
DataTable;
28
for
(
int
i
=
0
; i
<
tb.Rows.Count; i
++
)
29
{
30
sTable.ImportRow(tb.Rows[i]);
31
}
32
33
}
34
else
35
{
//
如果没有则从库中读取
36
sTable
=
GetTableInfo();
37
38
}
39
Session[L_guidvalue.Text.Trim()]
=
sTable;
40
}
41
this
.gv_productlist.DataSource
=
null
;
42
this
.gv_productlist.DataSource
=
sTable;
43
//
this.gv_productlist.PageSize = AspNetPager2.PageSize;
44
//
gv_productlist.PageIndex = AspNetPager2.CurrentPageIndex - 1;
45
AspNetPager2.RecordCount
=
sTable.Rows.Count;
46
this
.gv_productlist.DataBind();
47
//
Session[L_guidvalue.Text.Trim()] = null;
48
}
我的淘宝店:
http://hamby.taobao.com
查看全文
相关阅读:
输入汉字转拼音
DBGridEh(RestoreGridLayoutIni)用法
当选中节点的同时选中父节点
implsments
HTML中的post和get
SmartUpload中文乱码
调查平台,考试系统类型的数据收集型项目
final
职业生涯中12个最致命的想法
abstract
原文地址:https://www.cnblogs.com/hambywu/p/1597191.html
最新文章
poj2240 Arbitrage
poj3259 Wormholes
poj2983 Is the Information Reliable?
poj1789 Truck History
poj1364 King
SqlServer2008安装错误
js禁用退格键(BackSpace)
win7访问共享服务器出错“错误代码:0x800704cf 不能访问网络位置”
ReportingService 开发总结
C# 根据中文得到全拼
热门文章
Web可视化工作流
通过post方法远程获取一个页面
超级日期控件
delphi checklistbox用法
Treeview选中所有节点
设置ListView显示CheckBox
存储过程中动态调用SQL语句
在程序中执行脚本
DBGridEh标题分行显示
TreeView 节点多选,对TreeView的遍历
Copyright © 2011-2022 走看看