怎么给动态创建的GridView添加SelectIndexChanged事件 20
2个回答
展开全部
首先定义个事件函数:
protected void GridView1SelectIndexChanged(object sender, EventArgs e)
{
//事件处理...
}
然后在创建GridView时,增加SelectIndexChanged事件绑定:
GridView gv1=new GridView();
...
gv1.SelectIndexChanged += new EventHandler(GridView1SelectIndexChanged);
...
protected void GridView1SelectIndexChanged(object sender, EventArgs e)
{
//事件处理...
}
然后在创建GridView时,增加SelectIndexChanged事件绑定:
GridView gv1=new GridView();
...
gv1.SelectIndexChanged += new EventHandler(GridView1SelectIndexChanged);
...
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询