How do I stop the DataGrid Header from Displaying when the DataSet has no values?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngdatagridrepeaterdatalist' list.


Bill Bassler
Is there a property that I can set to turn off header display when bound to
an empty DataSet/Table automatically
... or do I need to check the DataSet.Table I'll be binding to for rows and
write some code to make the DataGrid invisible?

Reply to this message...
 
    
Tim
Hello,

You can always set the 'visible' property to false when the dataset has =
no values...

Regards,
Tim

----- Original Message -----
From: "Bill Bassler" <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Fri, 16 Aug 2002 15:41:18 -0400
Subject: How do I stop the DataGrid Header from Displaying when the =
DataSet has no values?
[Original message clipped]

Reply to this message...
 
    
Bill Bassler
What's the best way to tell if the DataSet has no values?

"Tim" <Click here to reveal e-mail address> wrote in message
news:699174@aspngdatagridrepeaterdatalist...

Hello,

You can always set the 'visible' property to false when the dataset has no
values...

Regards,
Tim

----- Original Message -----
From: "Bill Bassler" <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Fri, 16 Aug 2002 15:41:18 -0400
Subject: How do I stop the DataGrid Header from Displaying when the DataSet
has no values?
[Original message clipped]

Reply to this message...
 
    
Tim
First you do a databind. After that, you can get the number of rows =
with this operation:

System.Web.UI.WebControls.DataGrid dGrid;
int nrRows =3D dGrid.Items.Count;

----- Original Message -----
From: "Bill Bassler" <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Fri, 16 Aug 2002 16:01:55 -0400
Subject: Re: How do I stop the DataGrid Header from Displaying when the =
DataSet has no values?
[Original message clipped]

To: Click here to reveal e-mail address
Sent: Fri, 16 Aug 2002 15:41:18 -0400
Subject: How do I stop the DataGrid Header from Displaying when the =
DataSet
[Original message clipped]

Reply to this message...
 
    
Tim Royal
i think if you do wind up checking the dataset/table for 0 rows, you can
skip the databind() call entirely and spare the server the work of creating
it and persisting its viewstate.

    DataSet ds = <-- create your dataset

    if (ds.Table[0].Rows.Count != 0)
    {
        grid.DataSource = ds;
        grid.DataBind();
    }

something like that, maybe?

tim

->-----Original Message-----
->From: Bill Bassler [mailto:Click here to reveal e-mail address]
->Sent: Friday, August 16, 2002 12:41 PM
->To: aspngDataGridRepeaterDatalist
->Subject: [aspngdatagridrepeaterdatalist] How do I stop the DataGrid
->Header from Displaying when the DataSet has no values?
->
->
->Is there a property that I can set to turn off header display
->when bound to
->an empty DataSet/Table automatically
->... or do I need to check the DataSet.Table I'll be binding
->to for rows and
->write some code to make the DataGrid invisible?
->
->
->
->| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID
->|
->http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdata
list.asp = JOIN/QUIT

Reply to this message...
 
    
Matt Hauser

if (myDataSet.Tables[0].Rows.Count =3D=3D 0)

-----Original Message-----
From: Bill Bassler [mailto:Click here to reveal e-mail address]
Sent: Friday, August 16, 2002 4:02 PM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] Re: How do I stop the DataGrid
Header from Displaying when the DataSet has no values?

What's the best way to tell if the DataSet has no values?

"Tim" <Click here to reveal e-mail address> wrote in message
news:699174@aspngdatagridrepeaterdatalist...

Hello,

You can always set the 'visible' property to false when the dataset has
no
values...

Regards,
Tim

----- Original Message -----
From: "Bill Bassler" <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Fri, 16 Aug 2002 15:41:18 -0400
Subject: How do I stop the DataGrid Header from Displaying when the
DataSet
has no values?
[Original message clipped]

| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address =3D
YOUR ID
| http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp
=3D JOIN/QUIT

Reply to this message...
 
 
System.Data.DataSet
System.Web.UI.WebControls.DataGrid
System.Windows.Forms.DataGrid




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com