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

Disabling grid navigation button as per condition

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
naimish
Top achievements
Rank 1
naimish asked on 15 Sep 2010, 03:22 PM
Hi,

I am working on radgrid  control, having page navigation buttons like <<Prev 1,2,3 ... Next>>
what i want is that, if it is 1st page (or default page), then <<prev button should be disabled or change the background color of button.
if the page is last then Next>> button should be disabled.

1 Answer, 1 is accepted

Sort by
0
naimish
Top achievements
Rank 1
answered on 15 Sep 2010, 03:54 PM

Hi All,

I am able to do it by simple code.

protected void RadGrid1_ItemCreated1(object sender, GridItemEventArgs e)
        {
  if (e.Item is GridPagerItem)
            {
 
if (gridPager.Paging.IsFirstPage)
                 {
                     ((Button)e.Item.FindControl("Button1")).ForeColor = System.Drawing.Color.Gray; (Represent Prev)
                     ((Button)e.Item.FindControl("Button1")).Enabled = false;                 

                }
                else if (gridPager.Paging.IsLastPage)
                {
                    ((Button)e.Item.FindControl("Button2")).ForeColor = System.Drawing.Color.Gray; (Represent Next)
                    ((Button)e.Item.FindControl("Button2")).Enabled = false;

                }

    }



        }
Tags
Grid
Asked by
naimish
Top achievements
Rank 1
Answers by
naimish
Top achievements
Rank 1
Share this question
or