anitha T

anitha T

  • NA
  • 73
  • 8k

Data source is an invalid type

Jun 27 2017 4:39 AM
i got error as 
Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
  BL b = new BL();
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
string X = Convert.ToString(e.CommandArgument);
int index = Convert.ToInt32(X);
GridViewRow row = (GridViewRow)GridView1.Rows[index];
Label id = (Label)row.FindControl("lbl1");
int artid = Convert.ToInt32(id.Text);
GridView1.DataSource =b.DeleteProList(artid);
GridView1.DataBind();
 
DAL:
public int DeleteProList(int proId)
{
con.Open();
SqlCommand cmd = new SqlCommand("sp_deleteProjectList", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ProjectId", proId);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
int i = Convert.ToInt32(cmd.ExecuteNonQuery());
return i;
}
 
BL:
public int DeleteProList(int proId)
{
return d.DeleteProList(proId);
}
 
 
 
 
 
 

Answers (2)