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

GridPagerItem in GridTableView

3 Answers 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 09 Feb 2012, 04:06 PM
I am trying to adapt this demo to customize the pager in a telerik:GridTableView
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/customizingpager/defaultcs.aspx

I cannot figure out how to access the GridPagerItem in my GridTableView

Thanks,
JIm

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Feb 2012, 04:29 AM
Hello Jim,

Try the following code.
c#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
 if(e.Item is GridPagerItem && e.Item.OwnerTableView.Name == "DetailTableName")
 {
   GridPagerItem PagerItem = (GridPagerItem)e.Item;
 }
}

-Shinu.
0
Jim
Top achievements
Rank 1
answered on 10 Feb 2012, 03:52 PM
That works, e.Item.OwnerTableView.Name  was what i needed. Thanks for the prompt response.
0
Gaurav
Top achievements
Rank 1
answered on 18 Feb 2015, 06:57 AM
Hi Shinu, I was not able to post a new thread so thought of adding to this one. I have gone a similar issue for casting from GridPagerItem to GridDataItem in the following code snippet. The strange part is that this worked in one instance and I could run my code. Now suddenly this one is not working. Any help is much appreciated.

protected void SearchResultsUltraWebGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    GridDataItem item = (GridDataItem)e.Item;
    SelectMember1(item);
}

The highlighted line is throwing the below error.

{"Unable to cast object of type 'Telerik.Web.UI.GridPagerItem' to type 'Telerik.Web.UI.GridDataItem'."}
Tags
Grid
Asked by
Jim
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jim
Top achievements
Rank 1
Gaurav
Top achievements
Rank 1
Share this question
or