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

[Solved] Border problem in Filter , Next , Previous icons of Rad Grid

4 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tapinder
Top achievements
Rank 1
Tapinder asked on 08 Oct 2009, 06:36 PM
Hi,

I am using Themes in my application. The Filter, Next, Previous, Move Last and Move First icons of Rad Grid shows border around these icons.

How to get rid of the border from these icons?

Thanks,
Pal

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 09 Oct 2009, 03:35 PM
Hello Pal,

I suppose you have some global styles for asp:Buttons in your ASP.NET theme. These are applied to the RadGrid buttons as well.

You can either set EnableTheming="false" to the RadGrid control or use SkinIDs for the theme settings, so that they are not applied to buttons unconditionally.

Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tapinder
Top achievements
Rank 1
answered on 15 Oct 2009, 05:27 PM
Hi Dimo,

You are right, I am using global styles for asp:Buttons and these are applied to the RadGrid buttons.

I am using the "ItemDataBound" to set the border of the pager buttons(First, Previous, Next, Last) to zero pixel.

The "ItemDataBound" sets the border for "First" and "Next" buttons to zero pixel but "Previous" and "Last" buttons are still getting the border as per the global styles for asp:Buttons.

I am using the following code to set the border of the RadGrid Pager buttons :-

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
            {
                if (e.Item is GridPagerItem)
                {
                    try
                    {
                        //create an object of GridPagerItem
                        GridPagerItem pagerItem = e.Item as GridPagerItem;
                        //call the function to set the border of buttons to zero pixel
                        FindButtonAndSetBorder(pagerItem.Controls);
                    }
                    catch (Exception ex)
                    {
                        //catch the error
                    }
                }
            }

------------------------------------------------------------------------------------------------




public static void FindButtonAndSetBorder(System.Web.UI.ControlCollection rootControls)
            {
                try
                {
                    //check if the rootControls is not null and count is greater than 0
                    if (rootControls != null && rootControls.Count > 0)
                    {
                        //loop through all the each control in rootControls
                        for (int i = 0; i < rootControls.Count; i++)
                        {
                            //if the control type is Button then set its border to 0 pixel
                            //else call myself again to perform the same action
                            if (rootControls[i] is Button)
                            {
                                Button btnToModify = (Button)rootControls[i];
                                btnToModify.BorderWidth = Unit.Pixel(0);
                                break;
                            }
                            else
                            {
                                FindButtonAndSetBorder(rootControls[i].Controls);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
0
Accepted
Dimo
Telerik team
answered on 20 Oct 2009, 08:16 AM
Hello Pal,

Your code works as expected on my side. Please review the attached example.


Regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tapinder
Top achievements
Rank 1
answered on 20 Oct 2009, 02:29 PM
Hello Dimo,

Thanks for the example. Something is wrong with my code. If i run my code then it still shows border on some pager buttons but if i run your code then it works fine and removes border from all the pager buttons.

Thanks,
Tapinder
Tags
Grid
Asked by
Tapinder
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Tapinder
Top achievements
Rank 1
Share this question
or