主题:DataGrid问题
我用.net 2003时写this.BindToDataGrid();时显示BindToDataGrid非默认函数,而我也看到别人有直接用的,怎么回事???
代码如下:
private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
String danweiid=this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
SqlConnection con=DB.creatConnection();
SqlCommand cmd=new SqlCommand("delete from 单位名称 where 单位ID='"+danweiid+"'",con);
con.Open();
cmd.ExecuteNonQuery();
this.DataGrid1.DataBind();
this.BindToDataGrid();//----显示此处有错误,BindToDataGrid非默认函数?
代码如下:
private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
String danweiid=this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
SqlConnection con=DB.creatConnection();
SqlCommand cmd=new SqlCommand("delete from 单位名称 where 单位ID='"+danweiid+"'",con);
con.Open();
cmd.ExecuteNonQuery();
this.DataGrid1.DataBind();
this.BindToDataGrid();//----显示此处有错误,BindToDataGrid非默认函数?