I have added a scrollbar (<div style="OVERFLOW: auto; HEIGHT: 250px">) to my gridview so that if the PageSize exceeds 10 rows the user can use the scrollbar. The width of the table that embeds the gridview is 925px and the width of the gridview is 912px where 13px is being left for the scrollbar.
What I'm trying to figure out is that when the grid has 10 or less rows the width of the gridview should be 925px so there isn't 13 px of space left and when there are more 10 rows the width of the grid should be 912 px leaving room for the scrollbar.
What I thought I could do is in the unload event of the gridview have a condition that checks the count of the rows and if the pagesize exceeds 10 rows then set the width of the gridview to 912 else set the width to 925. Unfortunately, that doesn't work.
So any suggestions will be appreciated.
protected void gvCallDetails_Unload(object sender, System.EventArgs e)
{
if (gvCallDetails.Rows.Count > 10)
{
gvCallDetails.Width = 912;
}
else
{
gvCallDetails.Width = 925;
}
}
What I'm trying to figure out is that when the grid has 10 or less rows the width of the gridview should be 925px so there isn't 13 px of space left and when there are more 10 rows the width of the grid should be 912 px leaving room for the scrollbar.
What I thought I could do is in the unload event of the gridview have a condition that checks the count of the rows and if the pagesize exceeds 10 rows then set the width of the gridview to 912 else set the width to 925. Unfortunately, that doesn't work.
So any suggestions will be appreciated.
protected void gvCallDetails_Unload(object sender, System.EventArgs e)
{
if (gvCallDetails.Rows.Count > 10)
{
gvCallDetails.Width = 912;
}
else
{
gvCallDetails.Width = 925;
}
}