this is my code...i just try to search the result by the name of school.but the grid view didnt show any thing.my code is
public void gridfill()
{
markSp spMark = new markSp();
DataTable dtbl = new DataTable();
dtbl = spMark.markViewAll();
gvResult.DataSource = dtbl;
dtbl = spMark.markViewBySchool(txtSchoolName.Text);
gvResult.DataSource = dtbl;
}
protected void Button1_Click(object sender, EventArgs e)
{
gridfill();
}
public DataTable markViewAll()
{
DataTable dtbl = new DataTable();
SqlDataAdapter sqlda = new SqlDataAdapter("markViewAll", sqlcon);
sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
sqlda.Fill(dtbl);
return dtbl;
}
public DataTable markViewBySchool(string viewBySchool)
{
DataTable dtbClass = new DataTable();
SqlDataAdapter sqlda = new SqlDataAdapter("markViewBySchool",sqlcon);
sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
sqlda.SelectCommand.Parameters.Add("@schoolName", SqlDbType.VarChar).Value = viewBySchool;
sqlda.Fill(dtbClass);
return dtbClass;
}