1

I placed a ASP DataRepeater in the PagerTemplate of a GridView. I need to find the DataRepeater in my code

I'm Trying this.

Repeater rptPager = (Repeater)gv_Inbox.BottomPagerRow.FindControl("rptPager");

But this is Throwing a Exception

Object reference not set to an instance of an object.

When I try

GridViewRow row = gv_Inbox.BottomPagerRow;

It returns Null.

I'm trying Custom paging in GridView. In that I'm able to place the Repeater Below the GridView and use paging. But I want to place the repeater on the bottom of the GridView ie. the Pager Row. So how can I do this??

Can you Help Me??

Krishna Thota
  • 6,646
  • 14
  • 54
  • 79

2 Answers2

2

The BottomPagerRow property is available only after the GridView control creates the bottom pager row in the RowCreated event.

try event like DataBound, you can find the controls inside BottomPagerRow

Damith
  • 62,401
  • 13
  • 102
  • 153
  • I'm trying Custom paging in GridView. In that I'm able to place the Repeater Below the GridView and use paging. But I want to place the repeater on the bottom of the GridView ie. the Pager Row. So how can I do this?? – Krishna Thota Oct 22 '12 at 10:14
  • I placed my code in GridView_RowDatabound and It is working now. Butthe problem is the PagerRow is not Displaying – Krishna Thota Oct 22 '12 at 10:49
  • reduce PageSize property of the gridview, if you have 5 records you need to set page size as value less than 5, then only PagerRow visible – Damith Oct 22 '12 at 11:00
0

Add following line to "RowDataBound" then you will have access.

If e.Row.RowType <> DataControlRowType.Pager Then Exit Sub
davidWazy
  • 61
  • 6