L
Lynn
Please help!
My gridview displays with two empty rows. There is no error message,
just no data. I am at wits end and really wondering why we work so
hard to have our lives made so easy by these pre-packaged controls.
I have a gridview with 4 bound columns. Each column is defined as
bound and has been given a header title, but that is all. I also have
a dataset with two rows, 4 columns each. I have verified that the
dataset has data. Yet the DataBind method does not seem to work.
Thanks for any help.
public partial class DataGridPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindViaDataHelper();
}
}
public void BindViaDataHelper()
{
DatabaseHelper objDataHelper = new DatabaseHelper();
string[] arrProcName = new string[1];
string[] arrTableName = new string[1];
arrProcName[0] = "Select PICKERUPPER.FNAME,
PICKERUPPER.LNAME, PICKERUPPER.PHONE, RELATIONSHIP.NAME from
PICKERUPPER, RELATIONSHIP where PICKERUPPER.RELATIONSHIPID =
RELATIONSHIP.ID order by PICKERUPPER.LNAME";
arrTableName[0] = "AuthorizedPickerUppers";
DataSet ds = objDataHelper.GetDataSet(arrProcName,
arrTableName);
this.GridView1.DataSource = ds;
if (ds.Tables[0].Rows.Count > 0)
{
this.GridView1.DataBind();
}
else
{
// do something else
}
}
My gridview displays with two empty rows. There is no error message,
just no data. I am at wits end and really wondering why we work so
hard to have our lives made so easy by these pre-packaged controls.
I have a gridview with 4 bound columns. Each column is defined as
bound and has been given a header title, but that is all. I also have
a dataset with two rows, 4 columns each. I have verified that the
dataset has data. Yet the DataBind method does not seem to work.
Thanks for any help.
public partial class DataGridPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindViaDataHelper();
}
}
public void BindViaDataHelper()
{
DatabaseHelper objDataHelper = new DatabaseHelper();
string[] arrProcName = new string[1];
string[] arrTableName = new string[1];
arrProcName[0] = "Select PICKERUPPER.FNAME,
PICKERUPPER.LNAME, PICKERUPPER.PHONE, RELATIONSHIP.NAME from
PICKERUPPER, RELATIONSHIP where PICKERUPPER.RELATIONSHIPID =
RELATIONSHIP.ID order by PICKERUPPER.LNAME";
arrTableName[0] = "AuthorizedPickerUppers";
DataSet ds = objDataHelper.GetDataSet(arrProcName,
arrTableName);
this.GridView1.DataSource = ds;
if (ds.Tables[0].Rows.Count > 0)
{
this.GridView1.DataBind();
}
else
{
// do something else
}
}