最新添加的记录标识

发布时间:2020-05-07 20:16:49 作者:davidangel
来源:网络 阅读:300

利用sql 表中的标识字段作为键码,该值总是递增的。

 

在GRIDVIEW的ROWDATABOUND事件中获取改标识字段的值,可以得到最新添加的记录标识

 

  protected void gvsbls_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string str1;

        int tmpflag = 0;

        if (e.Row.RowType == DataControlRowType.DataRow)
        {//空记录时不能设置
            Button btnHiddenPostButton2 = e.Row.FindControl("btn2") as Button;
            if (btnHiddenPostButton2 != null)
            {
                str1 = btnHiddenPostButton2.ClientID;
                e.Row.Attributes[" = String.Format("javascript:document.getElementById('{0}').click()", btnHiddenPostButton2.ClientID);
                // 额外样式定义
                e.Row.Attributes[" = "javascript:this.style.background='yellow'";
                e.Row.Attributes[" = "javascript:this.style.background=''";
                e.Row.Attributes["style"] = "cursor:pointer";
                e.Row.Attributes["title"] = "单击当前记录可查看批复结果";

                tmpflag = Convert.ToInt16(e.Row.Cells[11].Text);

                if (tmpflag > maxflag) maxflag = tmpflag;

            }
            // 若希望将隐藏按钮单独放于一列,则设置此列隐藏,占位符 <cellIndex> 表示此列索引

 

        }

推荐阅读:
  1. CloudFlare API:批量添加域名并添加解析记录
  2. php的标识有哪些?

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

职场 记录 休闲

上一篇:在mysql 使用binlog日志

下一篇:mongodb 中shell无法删除问题

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》