DataGrid?

  • Thread starter Thread starter rcoco
  • Start date Start date
R

rcoco

hi,
I'm having problem with seeing my datagrid? Yet I set Property visible
to true and I'm caling the DataBind() what could be the Problem. I
mayed be forgetting something.. Could you please help?
Thanks?
 
Well, there isn't exactly much to go on...

Can you reproduce the problem in simple (postable) code?
And can you clarify: winform or webform?

Marc
 
Yes Marc I'm using webform and the code that I'm using is just here
below:

private void Page_Load(object sender, System.EventArgs e)
{
if (! IsPostBack)
{
BindDataGrid();

}
}

private void BindDataGrid()
{
SqlDataAdapter myAdapter=new SqlDataAdapter("SELECT * from
Billing",con);
DataSet ds=new DataSet();
myAdapter.Fill(ds);
con.Open();
dgbilling.DataSource=ds;
dgbilling.DataBind();
con.Close();
}

Thanks.
 
OK this is really an ASP.NET question, but here goes:

1) you need to ensure that your SQL Statement is actually returning rows. If
not, your grid won't show anything, because there won't be anything for it to
show.
2) Generally speaking, you are going to bind your grid to one of the
DATATABLES in the returned DataSet, not to the DataSet itself.
Hope that helps.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top