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

AllowCustomPaging and export command

2 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marko Gluhak
Top achievements
Rank 1
Marko Gluhak asked on 27 Feb 2012, 06:00 PM
Hi,

I'm using radGrid with custom paging. I also use NeedDataSource event to get data.

I stuck when I click Export command in item Command row (I only have export command). I dont know how to distinguish that export command is clicked inside NeedDataSource method (because its executing before Export event of grid).

I have tried this:
if (e.RebindReason == GridRebindReason.ExplicitRebind)
            {
                rgActions.AllowPaging = false;
                rgActions.AllowCustomPaging = false;
            }
            else
            {
                rgActions.AllowPaging = true;
                rgActions.AllowCustomPaging = true;
             
            }

but its not ok because explicit rebinding is also done when any othe button is clicked on page that rebind grid.


2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 28 Feb 2012, 06:49 AM
Hello Marko,

You can check for the CommandName as shown below.
C#:
protected void grid_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.CommandName == RadGrid.ExportToExcelCommandName)
  {
  }
}

-Shinu.
0
Marko Gluhak
Top achievements
Rank 1
answered on 01 Mar 2012, 12:48 PM
Hi,

thank you. This event is executed before needdatasource so its exactly what i needed.
Tags
Grid
Asked by
Marko Gluhak
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Marko Gluhak
Top achievements
Rank 1
Share this question
or