This is a migrated thread and some comments may be shown as answers.

Paging controls are always visible

4 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chamitha
Top achievements
Rank 1
Chamitha asked on 19 Nov 2008, 01:37 AM
Even though the number of items in the grid is less than the PageSize the paging controls are displayed. I only want these controls to be displayed if there are multiple pages. I believe the PagerStyle.AlwaysVisible attribute controls this.

<

MasterTableView
PagerStyle-AlwaysVisible="false"
PageSize="20"
AllowPaging="true"
PagerStyle-Mode="NextPrev">

 

 

 

 

 

 

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Nov 2008, 04:18 AM
Hi Chamitha,

Try the following code snippet to hide the Pager when the number of items in the Gird is less than the PageSize.

CS:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        if (RadGrid1.MasterTableView.Items.Count < RadGrid1.PageSize ) 
        { 
            RadGrid1.MasterTableView.PagerStyle.Visible = false
        } 
    } 



Regards
Shinu.
0
Chamitha
Top achievements
Rank 1
answered on 19 Nov 2008, 04:57 AM
That didnt make a difference. I still see the pager controls. I verified the Pre_Render method is executed and the Visible property value is change to false. However the controls still appear.
0
Shinu
Top achievements
Rank 2
answered on 20 Nov 2008, 03:53 AM
Hi Chamitha,

Try rebinding the Grid after setting its visibilty to false.

CS:
protected void RadGrid1_PreRender(object sender, EventArgs e)  
    {  
        if (RadGrid1.MasterTableView.Items.Count < RadGrid1.PageSize )  
        {  
            RadGrid1.MasterTableView.PagerStyle.Visible = false;  
        }  
          RadGrid1.MasterTableView.Rebind(); 
    }  



Regards
Shinu
0
Chamitha
Top achievements
Rank 1
answered on 20 Nov 2008, 11:35 PM
No luck with that either. Same result.
As an aside setting AllowPaging to false causes the pager controls not to be displayed as expected.

 

RadGrid1.MasterTableView.AllowPaging = false;<BR> 

Tags
Grid
Asked by
Chamitha
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Chamitha
Top achievements
Rank 1
Share this question
or