browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need ASP.NET help?

Get answers from our community of ASP.NET experts on BYTES! It's free.

Data grid!

rcoco
Guest
 
Posts: n/a
#1: Feb 20 '07
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?




=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
 
Posts: n/a
#2: Feb 20 '07

re: Data grid!


Hi Rococo,

Paste some code so we could investigate.
--
Milosz


"rcoco" wrote:
Quote:
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?
>
>
rcoco
Guest
 
Posts: n/a
#3: Feb 20 '07

re: Data grid!


On Feb 20, 2:17 pm, Milosz Skalecki [MCAD] <mily...@DONTLIKESPAMwp.pl>
wrote:
Quote:
Hi Rococo,
>
Paste some code so we could investigate.
--
Milosz
>
>
>
"rcoco" wrote:
Quote:
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?- Hide quoted text -
>
- Show quoted text -
hi miloz,
here is the code I'm using.

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.

=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
 
Posts: n/a
#4: Feb 20 '07

re: Data grid!


You're opening connection after Filling the dataset: You should always open
connection first (i amended the code a little bit):

private void BindDataGrid()
{

SqlDataAdapter myAdapter=new SqlDataAdapter("SELECT * from Billing", con);
DataSet ds = new DataSet();

try
{
con.Open():
myAdapter.Fill(ds);
}
catch
{
throw;
}
finally
{
con.Close();
}

dgbilling.DataSource = ds;
dgbilling.DataBind();

}

Hope it helps

Milosz


"rcoco" wrote:
Quote:
On Feb 20, 2:17 pm, Milosz Skalecki [MCAD] <mily...@DONTLIKESPAMwp.pl>
wrote:
Quote:
Hi Rococo,

Paste some code so we could investigate.
--
Milosz



"rcoco" wrote:
Quote:
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?- Hide quoted text -
- Show quoted text -
>
hi miloz,
here is the code I'm using.
>
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.
>
>
rcoco
Guest
 
Posts: n/a
#5: Feb 20 '07

re: Data grid!


Thanks Miloz but it did not work.. I wonder why it does not work yet I
used the same code and it worked on a different project..
Thanks

=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
 
Posts: n/a
#6: Feb 20 '07

re: Data grid!


Hi there again,

Did you check if the query is returning any results? Put a breakpoint at
dgbilling.DataSource = ds
and watch for quick ds.Tables[0].Rows.Count value.
--
Milosz


"rcoco" wrote:
Quote:
Thanks Miloz but it did not work.. I wonder why it does not work yet I
used the same code and it worked on a different project..
Thanks
>
>
Ralph
Guest
 
Posts: n/a
#7: Feb 20 '07

re: Data grid!


On Feb 20, 7:38 am, "rcoco" <nclau...@yahoo.cawrote:
Quote:
Thanks Miloz but it did not work.. I wonder why it does not work yet I
used the same code and it worked on a different project..
Thanks
Can we see the code in the aspx file for the data grid?
Also I are you sure your query is bringing back data?

Closed Thread