在GridView中增加几个按钮:

<asp:ButtonField Text="SingleClick"  CommandName="SingleClick" Visible="False" /> 

 

LinkButton _singleClickButton = (LinkButton)e.Row.Cells[0].Controls[0];
                // 返回一个字符串,表示对包含目标控件的 ID 和事件参数的回发函数的 JavaScript 调用
                string _jsSingle = ClientScript.GetPostBackClientHyperlink(_singleClickButton, "");

                _jsSingle = "selectIndex(this," + e.Row.RowIndex.ToString() + ");" + _jsSingle;
                e.Row.Attributes["onclick"] = _jsSingle;

posted on 2012-10-17 09:58  Black Bean  阅读(156)  评论(0编辑  收藏  举报