会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
loadin Do…
一条只能往前走的路,叫时光.
首页
联系
订阅
管理
公告
vs2005中gridview的RowCommand事件
RowCommand事件
代码
protected
void
GridView1_RowCommand(
object
sender, GridViewCommandEventArgs e)
{
//
e.CommandArgument获得命令行的索引
if
(e.CommandName
==
"
SetNotice
"
)
{
if
(
!
demo.methods(Convert.ToInt32(
this
.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value),
userid))
{
base
.MessageBox(
string
.Empty, OpNotice.strErrMsg);
}
else
{
base
.MessageBox(
string
.Empty,
"
设置成功
"
);
DataBinds();
}
}
}
代码2
protected
void
GridView1_RowCommand(
object
sender, GridViewCommandEventArgs e)
{
if
(e.CommandName
==
"
SetStatus
"
)
{
string
commstr
=
((LinkButton)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[
3
].Controls[
0
]).Text;
if
(commstr
==
"
设为私有
"
)
//
change for field's [status]=1
{
if
(
!
opProduct.Sys_SetStatus(Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value),
1
))
{
MessageBox(
string
.Empty, opProduct.strErrMsg);
}
else
{
DataBinds();
}
}
else
if
(commstr
==
"
设为公开
"
)
//
change for field's [status]=0
{
if
(
!
opProduct.Sys_SetStatus(Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value),
0
))
{
MessageBox(
string
.Empty, opProduct.strErrMsg);
}
else
{
DataBinds();
}
}
}
if
(e.CommandName
==
"
SetCommend
"
)
//
insert product commend
{
if
(
!
opProductCommend.SysIsExist(Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value)))
{
MessageBox(
string
.Empty, opProductCommend.strErrMsg);
}
else
{
if
(opProductCommend.dataView.Table.Rows.Count
>
0
)
{
MessageBox(
string
.Empty,
"
推荐已存在
"
);
return
;
}
}
if
(
!
opProductCommend.SysInsert(Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value)))
{
MessageBox(
string
.Empty, opProductCommend.strErrMsg);
}
else
{
MessageBox(
string
.Empty,
"
推荐成功
"
);
DataBinds();
}
}
posted on
2006-12-20 23:03
i'am sl
阅读(
486
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
博客园
© 2004-2026
浙公网安备 33010602011771号
浙ICP备2021040463号-3