美丽的老师宁心怡结局:DataGrid 之 ItemCommand 疑问

来源:百度文库 编辑:高考问答 时间:2024/04/28 09:11:53
1、Button的ID属性与CommandName属性有何区别?

2、下面代码为何不能执行?
private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (e.CommandName== "myDataGridButton")
{
Response.Redirect("http://www.sohu.com");
}
}

注:myDataGridButton为DataGrid1子控件按钮的CommandName,我试过用ID属性也无济于事,请帮助解决,谢谢。

CommandName 是程序中给 出的 已经经过编译的

Button id 只是 控件的标识 不一样的