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

style pagesize

2 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Spire
Top achievements
Rank 1
Spire asked on 09 Sep 2010, 11:06 AM
Hi,

I'm have problems styling a page-size dropdown box in a Radgrid. The Page-size dropdown is to big in width and height.

Link to my page
Could anyone help me please?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Sep 2010, 12:58 PM
Hello Spire,

Access the PageSize ComboBox of grid from code behind and set its height and width accordingly .

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridPagerItem)
        {
            RadComboBox combo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
            combo.Height = System.Web.UI.WebControls.Unit.Pixel(100);
            combo.Width = System.Web.UI.WebControls.Unit.Pixel(100);
        }
    }

Or add the following css in your page.

CSS:
<style type="text/css"
.RadGrid_Default .rgPager .RadComboBox 
      width:50px !important
</style>

Thanks,
Princy.
0
Accepted
Dimo
Telerik team
answered on 09 Sep 2010, 01:27 PM
Hi,

The problem is that RadComboBox inherits padding styles from the web page:

div#result table tr td
{
    padding:4px;
    vertical-align:top;
}

Using CSS selectors with IDs inside them produces a very high specificity (one ID gives 100 specificity points), which easily overrides other styles, e.g. the ones of RadControls, which use only HTML elements (1 specificity point) and CSS classes in the selectors (one CSS class = 10 specificity points).


CSS Specificity Things You Should Know About

Cascading Order (W3C CSS Standard)

CSS: What Happens When a Conflict Occurs


All the best,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Spire
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Dimo
Telerik team
Share this question
or