private void GridViewShow() ... { SqlConnection con = DB.CreateConnetcon(); string Strsql = "select * from NewsType"; SqlDataAdapter sda = new SqlDataAdapter(Strsql, con); DataSet myds = new DataSet(); con.Open(); sda.Fill(myds, "Newstmp"); DataView view = myds.Tables["Newstmp"].DefaultView; this.GridType.DataSource = view; this.GridType.DataKeyNames = new string[] ...{ "NewsTypeID" }; this.GridType.DataBind(); con.Close(); }