|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagrid empty data hides headerHi,
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 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 } Show quoteHide quote "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 I missed the line that checks for the dataview is null, e.g.
if (dv == null) { MyEmptyTable.Visible=true; GridView1.Visible = false; } Show quoteHide quote "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
Understanding query strings
CSS class for a div tag Referencing controls in a template programmatically Control.Controls bug? Control's child controls missing at the run time. Master Detail w Multiple Keys Tree View DragNode asp button click handler onload called only once preserve password field over steps in wizard validation controls are not working |
|||||||||||||||||||||||