文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ListView中命令行按钮应用;

ListView中命令行按钮应用;

时间:2011-05-12  来源:ゞ追忆o0ゞ

1, 获取当前行的行号:  int index = ((ListViewDataItem)e.Item).DisplayIndex;

2,获取当前行的主键:  int id = Convert.ToInt32(ListView1.DataKeys[index].value);

 

 

 protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            //获取当前行号;
            int index = ((ListViewDataItem)e.Item).DisplayIndex;
            //获取当前行号的主键;
            int id = Convert.ToInt32(ListView1.DataKeys[index].Value);

            if (e.CommandName == "IncSeqNo") //在Aspx页中添加一个按钮,CommandName为IncSeqNo
            {
                //获取DataSet
                T_FirendLinkTableAdapter adapter = new T_FirendLinkTableAdapter();
                //更新字段;
                adapter.UpdateQuery(id);
                //重新绑定;
                ListView1.DataBind();
            }
        }

 

相关阅读 更多 +
排行榜 更多 +
mirrox模组(玩家自制)手机版下载

mirrox模组(玩家自制)手机版下载

休闲益智 下载
集装箱模拟器手机版下载安装

集装箱模拟器手机版下载安装

模拟经营 下载
哔咔漫画app下载免费2025

哔咔漫画app下载免费2025

浏览阅读 下载