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

Something wrong with PagerStyle

17 Answers 194 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patxi
Top achievements
Rank 1
Patxi asked on 06 Apr 2009, 08:44 AM
Hi friends,

I am having a strange problem that is driving me crazy.

I am trying to get for my pager something between "NextPrev" and "NextPrevAndNumeric" mode. There´s something in "NextPrevAndNumeric" that I like but at the same time is adding one more thing that I want to delete.

The format is the following:

<<  <  1 2 3 4 5 6 7 8 9... >  >>   Page size: (checkbox) select    ...........................................

I would like to delete "Page size: checkbox select" part. For so I thought I would have to change it from the text in PagerTextFormat property. Unfortunately this text can´t be found in this property and therefore, it´s not possible to delete it.

I wouldn´t like to use PagerTemplate tag.

Is there any other way to remove this part?Am I missing something?

17 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Apr 2009, 10:16 AM
Hello Patxi,

You can access the label in the pager row and then clear its text as shown in the code below:
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)   
    { 
        if (e.Item is GridPagerItem) 
        { 
            GridPagerItem pager = (GridPagerItem)e.Item; 
            Label lbl = (Label)pager.FindControl("ChangePageSizeLabel"); 
            lbl.Text = "";          
        } 
    } 

Thanks
Princy.
0
Patxi
Top achievements
Rank 1
answered on 06 Apr 2009, 10:32 AM
Hi Princy,

I don´t know what you mean when saying to access the label in the pager row.

Could you explain it a bit better?

Thank you for your reply and help.
0
Princy
Top achievements
Rank 2
answered on 06 Apr 2009, 11:42 AM
Hi Patxi,

The text 'Page Size:' that you see in the pager row in the grid is actually set as the text of a label control. So inorder to hide the text, you would have to access the label and then set its text to null.
Hope you understood it better now!

-Princy.
0
Patxi
Top achievements
Rank 1
answered on 06 Apr 2009, 01:55 PM
Thank you for the snippet code and the explanation.

I have implemented this code and it removes correctly but I would also like to remove the dropdownlist and "select" text as well. I thought it would remove the whole text.

I also thought I would have to add a label control to remove the text but I was wrong.

I´m a bit confused. 

Sorry Princy for so many questions.
0
Princy
Top achievements
Rank 2
answered on 06 Apr 2009, 02:15 PM
 
0
Shinu
Top achievements
Rank 2
answered on 06 Apr 2009, 02:21 PM
Hello Patxi,

The Pager Item Control Collection of the grid consists of panel controls, out of which one panel controls contains the PageSizeLabel, the PageSizeDropDownList, etc. Hence, you can hide the panel to remove the unwanted controls according to your requirement:
C#:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridPagerItem)  
        {  
            GridPagerItem pager = (GridPagerItem)e.Item;  
            (pager.Controls[0].Controls[0].Controls[0].Controls[1].Controls[3]).Visible = false;  
        }  
    } 

Thanks
Shinu.
0
Patxi
Top achievements
Rank 1
answered on 06 Apr 2009, 02:39 PM
Thank you Shinu.

I have implemented your code and is not working. I get an ArgumentOutOfRangeException.

I have got the idea of your code but I don´t know how to use it.

Do you have any documentation for this?
0
Patxi
Top achievements
Rank 1
answered on 07 Apr 2009, 06:43 AM
I just need the last push to do it.

I got to remove the text "Page size:". I only need to remove teh drowpdownlist and the text "select" (this is a used to extend the dropdownlist).

Please, i would be grateful if you could help me, i must do this somehow.

Thank you in advance.
0
Angie
Top achievements
Rank 1
answered on 09 Apr 2009, 05:16 PM
I am having the same issue as Patxi.  It seems to me that there should be a property in the PagerStyle that could be set to show or hide the select page size info.
0
Yavor
Telerik team
answered on 10 Apr 2009, 06:26 AM
Hello Angie,

We are planning to include such a property for one of the upcoming versions of the control, to avoid having to programmatically remove it.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Angie
Top achievements
Rank 1
answered on 10 Apr 2009, 05:27 PM
I was able to hide it through CSS without having to add any code: ('Custom' is the name of my cssclass)

div.Custom .rgPager .rgAdvPart  
{  
    display:none;     
0
Yavor
Telerik team
answered on 13 Apr 2009, 01:08 PM
Hi Angie,

Indeed, this is another approach in this case. These are the css classes for the item, and overriding them to hide the control is a straightforward approach. I hope this meets your requirements well.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
bkelley7
Top achievements
Rank 1
answered on 13 Apr 2009, 05:20 PM
Yavor-

Do you all have a timeline as to when the property you mention in PagerStyle to show/hide the page size selection controls will be available?  In many circumstances, hiding these controls in the ItemCreated or ItemDataBound event handler isn't very practical given the number of grids in some large applications...

Thanks!
0
Yavor
Telerik team
answered on 14 Apr 2009, 08:56 AM
Hello,

Although I cannot commit to a definite timeframe, our developers will consider this implementation for one of the upcoming versions of the control. I hope the present workaround is a suitable replacement in the meantime.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
fca
Top achievements
Rank 2
answered on 02 Jun 2009, 07:12 AM
I tried Angie's suggestion but only managed to hide the pager text, not the combobox. I put it in Grid.Outlook.css
.RadGrid_Outlook .rgPager .rgPagerLabel, 
.RadGrid_Outlook .rgPager .RadComboBox, 
.RadGrid_Outlook .rgPager .RadInput_Outlook 
    margin:0 4px 0 0; 
    vertical-align:middle
    display:none

I am not going to subscribe to itemcreate event as there are a number of grid in my web project and custom paging is a no go. Any idea?
0
Princy
Top achievements
Rank 2
answered on 02 Jun 2009, 07:27 AM
Hello,

Try out the following css code to hide the combobox:
css:
.RadGrid_Outlook .rgPager .rgAdvPart   
   {   
    display:none
   } 

Thanks
Princy.
0
fca
Top achievements
Rank 2
answered on 02 Jun 2009, 07:38 AM
Thanks Princy. It worked.
Tags
Grid
Asked by
Patxi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Patxi
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Angie
Top achievements
Rank 1
Yavor
Telerik team
bkelley7
Top achievements
Rank 1
fca
Top achievements
Rank 2
Share this question
or