日期:2014-05-17  浏览次数:20454 次

gridview行单击
gridview行单击事件只能在页面加载后执行一次,代码:

        protected void dg_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string pkid = ((System.Data.DataRowView)(e.Row.DataItem)).Row["PKID"] as string;
                e.Row.Attributes["onclick"]=this.Page.ClientScript.GetPostBackEventReference(this, pkid);
            }
        }
        //IPostBackEventHandler借口实现
        void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
        {
            gridviewClick(eventArgument);
        }

        private void gridviewClick(string pkid)
        {
            BindPermit(pkid);
        }

不知道什么原因只能执行一次,求指导。
------解决方案--------------------
http://www.cnblogs.com/diaodiaop/archive/2012/04/26/2472741.html

这个是我以前写的.