GridView with ShowFooter and 0 rows
-
Is there a quick and easy way to show the Footer & Header of a GridView when datasource come back with 0 rows? Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)
-
Is there a quick and easy way to show the Footer & Header of a GridView when datasource come back with 0 rows? Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)
Here is some code: create this event if you don't already have it.
protected void GridView1_PreRender(object sender, EventArgs e)
{
if ((GridView1.PagerSettings.Position == PagerPosition.Top ||
GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
GridView1.TopPagerRow != null)
{
if (!GridView1.TopPagerRow.Visible)
{
GridView1.TopPagerRow.Visible = true;
}
}
if ((GridView1.PagerSettings.Position == PagerPosition.Bottom ||
GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
GridView1.BottomPagerRow != null)
{
if (!GridView1.BottomPagerRow.Visible)
{
GridView1.BottomPagerRow.Visible = true;
}
}
}Hope that helps. Ben
-
Here is some code: create this event if you don't already have it.
protected void GridView1_PreRender(object sender, EventArgs e)
{
if ((GridView1.PagerSettings.Position == PagerPosition.Top ||
GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
GridView1.TopPagerRow != null)
{
if (!GridView1.TopPagerRow.Visible)
{
GridView1.TopPagerRow.Visible = true;
}
}
if ((GridView1.PagerSettings.Position == PagerPosition.Bottom ||
GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
GridView1.BottomPagerRow != null)
{
if (!GridView1.BottomPagerRow.Visible)
{
GridView1.BottomPagerRow.Visible = true;
}
}
}Hope that helps. Ben
Unfortunately it didn't help with the showing of the Footer or Header when the grid's datasource property has 0 rows. Basically the insert/add new section of the grid is in the grid's Footer. When there are not rows to display for editing, I would still like the footer to display so that users can insert a new row. Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)