Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Datagrid empty data hides header

Reply
Thread Tools

Datagrid empty data hides header

 
 
Roby Eisenbraun Martins
Guest
Posts: n/a
 
      12-09-2005
Hi,

I have a gridview (NET 2005) and when it hasn't got values it shows a
nice "Not found" text message. But unfortunately all the gridview lay-out
hides( header, ... ).
Is there a property to keep the gridview visible even if the data is
empty?

Thank you,
Roby Eisenbraun Martins
 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      12-09-2005
Hi Roby,

I found in both ASP.NET 1.1 and 2.0 that you cannot do that except by having
another table (with its visible attribute set to false) on the page then upon
databinding you would set visible = true when the datasource is null, e.g.

protected void GridView1_DataBinding(boject sender, EventArgs e)
{
GridView gv= (GridView)sender;
DataView dv = (DataView)gv.DataSource;
//if you are using a Business Logic Layer then replace the prevous line with
//equivalent type casting
MyEmptyTable.visible=true; //this is the table that you left to display
if there were no data

}

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"Roby Eisenbraun Martins" wrote:

> Hi,
>
> I have a gridview (NET 2005) and when it hasn't got values it shows a
> nice "Not found" text message. But unfortunately all the gridview lay-out
> hides( header, ... ).
> Is there a property to keep the gridview visible even if the data is
> empty?
>
> Thank you,
> Roby Eisenbraun Martins

 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      12-09-2005
I missed the line that checks for the dataview is null, e.g.

if (dv == null) {
MyEmptyTable.Visible=true;
GridView1.Visible = false;
}


"Phillip Williams" wrote:

> Hi Roby,
>
> I found in both ASP.NET 1.1 and 2.0 that you cannot do that except by having
> another table (with its visible attribute set to false) on the page then upon
> databinding you would set visible = true when the datasource is null, e.g.
>
> protected void GridView1_DataBinding(boject sender, EventArgs e)
> {
> GridView gv= (GridView)sender;
> DataView dv = (DataView)gv.DataSource;
> //if you are using a Business Logic Layer then replace the prevous line with
> //equivalent type casting
> MyEmptyTable.visible=true; //this is the table that you left to display
> if there were no data
>
> }
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Roby Eisenbraun Martins" wrote:
>
> > Hi,
> >
> > I have a gridview (NET 2005) and when it hasn't got values it shows a
> > nice "Not found" text message. But unfortunately all the gridview lay-out
> > hides( header, ... ).
> > Is there a property to keep the gridview visible even if the data is
> > empty?
> >
> > Thank you,
> > Roby Eisenbraun Martins

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
hides inherited member ApplicationInstance Wayne Brantley ASP .Net 3 12-19-2005 02:06 AM
JAXB: Nested Type hides an Enclosing Type. chicagoandy@hotmail.com Java 6 03-02-2005 04:57 PM
listbox hides the drop down menu Reb ASP .Net 3 11-27-2003 10:38 AM
Approximately needed score (I know MS hides the score...) for passing 70-305??? Daniel Walzenbach MCSD 2 11-09-2003 10:04 PM



Advertisments