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
查看全文
相关阅读:
Python 语音识别
Python 无法安装PyAudio问题
webRTC脱坑笔记(四)— windows下Nginx对Node服务的反向代理
webRTC脱坑笔记(三)— webRTC API之RTCPeerConnection
webRTC脱坑笔记(二)— webRTC API之MediaStream(getUserMedia)
webRTC脱坑笔记(一)— 初识webRTC
StringBuffer
字符串的反转
数组的反转
String
原文地址:https://www.cnblogs.com/hambywu/p/1597191.html
最新文章
Laravel5 项目上线后务必将开发环境更改为生产环境以及特殊情况需要的“闭站维护”操作
CSS3 根据屏幕大小显示内容(@media)
验证码一(验证码生成)
域名解析到Nginx服务器项目上
点击图片指定地方进跳转不同链接
PHP 扩展 MongoDB
解决latex无法输入arccot的问题
Markdown语法
Sublime Text3 + Markdown + 实时预览
error LNK2019: 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainCRTStartup 中被引用
热门文章
对象成员
class类重定义
构造函数、析构函数、初始化列表
C++指针、引用、const
MySQL常用命令总结3
MySQL常用命令总结2
JavaScript漫谈之理解类型操作符typeof
openlayers学习笔记(十三)— 异步调用JSON数据画点、文字标注与连线
语音识别—前端录音传给后台语音识别
语音识别—前端录音上传服务器进行语音识别
Copyright © 2011-2022 走看看