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
查看全文
相关阅读:
QButton
注入
SpringBoot热重启配置
centos7 安装 tomcat
centos 安装jdk
spring boot (6) AOP的使用
spring boot (5) 自定义配置
spring boot (4) 使用log4 打印日志
SpringBoot (3)设置支持跨域请求
spring boot (2) 配置swagger2核心配置 docket
原文地址:https://www.cnblogs.com/hambywu/p/1597191.html
最新文章
oracle中dual表的使用
where 子句和having子句中的区别
分组统计查询
Left Join 与Right Join 与 Inner Join 与 Full Join的区别
SQL删除重复数据方法
redis面试题总结
缓存方案之Redis
Android 监听ListView、GridView滑动到底部
Android sqlite cursor的遍历
android 使用sqlite的一些注意事项
热门文章
android 输入法的打开和关闭
struts2 json关于Date日期的解析
Android 加载时在actionBar右上角添加一个加载图标
Spring 与 Hibernate 集成 Transactional设置为只读
Android 网络通信框架Volley简介(Google IO 2013)
Android 注意在finish Activity之后也要停止正在运行的请求
Android 通过程序添加桌面快捷方式
WIN7或者WIN8上边框的异常问题的解决攻略
鼠标钩子--- 悬浮窗口
DLL入门
Copyright © 2011-2022 走看看