From: someone on
> Why did you add it into gridview1_DataBound? I think this is the
> problem. Try Page_Load instead

Thanks Alexey for your answer.
I added it into gridview1_DataBound because I found some link where it
said that it must be added after databinding.
I'm not good enough with asp.net and english yet. =)

When I try to add it to Page_Load() I receive an error:
System.NullReferenceException: Object reference not set to an instance
of an object.

Thanks again.
Alexey Smirnov escribi�:
> On Dec 16, 3:31 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> wrote:
>> Hi again,
>>
>> I added this method:
>>
>> protected void gridview1_DataBound(object sender, EventArgs e)
>> {
>> gridview1.BottomPagerRow.Visible = true;
>> }
>>
>> Now when the record per pages is set to 100 and the number of record of
>> the query is lower (80 records as an example), now the PagerTemplate
>> appears in the webpage, but if I press the next or previous button the
>> PagerTemplates dissapears.
>> I think I have to set the BottomPagerRow property to true in another
>> method but I don't know wich one.
>>
>> Regards,
>> Marcelo.
>> Alexey Smirnov escribi�:
>>
>>
>>
>>> On Dec 15, 8:01 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
>>> wrote:
>>>> Hi,
>>>> I have added a PagerTemplate to a gridview, where I can select how many
>>>> records I want to show per page(20/50/100). I use this to set the
>>>> gridview pagesize.
>>>> The fact is that when I have 80 records to show and the gridview
>>>> pagesize is set to 100, the PagerTemplate dissapear, and I can't set the
>>>> records per page until I do a new query.
>>>> Is there a way to set the PagerTemplate always visible?.
>>>> In advance thanks for any help.
>>>> Regards,
>>>> Marcelo.
>>> Try to set the BottomPagerRow property to true.
>>> In addition, take a look athttp://www.ryanmcdonnell.com/always-show-the-pagertemplate-in-gridvie...
>>> Hope this helps- Hide quoted text -
>> - Show quoted text -
>
From: Alexey Smirnov on
On Dec 16, 4:13 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
wrote:
>  > Why did you add it into gridview1_DataBound? I think this is the
>  > problem. Try Page_Load instead
>
> Thanks Alexey for your answer.
> I added it into gridview1_DataBound because I found some link where it
> said that it must be added after databinding.
> I'm not good enough with asp.net and english yet. =)
>
> When I try to add it to Page_Load() I receive an error:
> System.NullReferenceException: Object reference not set to an instance
> of an object.
>
> Thanks again.
> Alexey Smirnov escribió:
>
>
>
> > On Dec 16, 3:31 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> > wrote:
> >> Hi again,
>
> >> I added this method:
>
> >> protected void gridview1_DataBound(object sender, EventArgs e)
> >>          {
> >>              gridview1.BottomPagerRow.Visible = true;
> >>          }
>
> >> Now when the record per pages is set to 100 and the number of record of
> >> the query is lower (80 records as an example), now the PagerTemplate
> >> appears in the webpage, but if I press the next or previous button the
> >> PagerTemplates dissapears.
> >> I think I have to set the BottomPagerRow property to true in another
> >> method but I don't know wich one.
>
> >> Regards,
> >> Marcelo.
> >> Alexey Smirnov escribió:
>
> >>> On Dec 15, 8:01 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> >>> wrote:
> >>>> Hi,
> >>>> I have added a PagerTemplate to a gridview, where I can select how many
> >>>> records I want to show per page(20/50/100). I use this to set the
> >>>> gridview pagesize.
> >>>> The fact is that when I have 80 records to show and the gridview
> >>>> pagesize is set to 100, the PagerTemplate dissapear, and I can't set the
> >>>> records per page until I do a new query.
> >>>> Is there a way to set the PagerTemplate always visible?.
> >>>> In advance thanks for any help.
> >>>> Regards,
> >>>> Marcelo.
> >>> Try to set the BottomPagerRow property to true.
> >>> In addition, take a look athttp://www.ryanmcdonnell.com/always-show-the-pagertemplate-in-gridvie...
> >>> Hope this helps- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

It tells that somewhere is an error. How did you setup the grid, is it
created in the code? Maybe you can post the complete code here...
From: someone on
Well, the error is here:
protected void Page_Load(object sender, EventArgs e)
{
gridview1.BottomPagerRow.Visible = true; //**ERROR**//
if (!IsPostBack)
{
OnViewInitialized();
}
OnViewLoaded();
}

It looks like it can't find the BottomPagerRow at that time.
But I don't know why...

Thanks for you help.
Regards,
Marcelo.
"Alexey Smirnov" <alexey.smirnov(a)gmail.com> wrote in message
news:a3bc0322-f87f-4bb3-bdd2-a3fcac5e22e9(a)u20g2000vbq.googlegroups.com...
On Dec 16, 4:13 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
wrote:
> > Why did you add it into gridview1_DataBound? I think this is the
> > problem. Try Page_Load instead
>
> Thanks Alexey for your answer.
> I added it into gridview1_DataBound because I found some link where it
> said that it must be added after databinding.
> I'm not good enough with asp.net and english yet. =)
>
> When I try to add it to Page_Load() I receive an error:
> System.NullReferenceException: Object reference not set to an instance
> of an object.
>
> Thanks again.
> Alexey Smirnov escribi�:
>
>
>
> > On Dec 16, 3:31 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> > wrote:
> >> Hi again,
>
> >> I added this method:
>
> >> protected void gridview1_DataBound(object sender, EventArgs e)
> >> {
> >> gridview1.BottomPagerRow.Visible = true;
> >> }
>
> >> Now when the record per pages is set to 100 and the number of record of
> >> the query is lower (80 records as an example), now the PagerTemplate
> >> appears in the webpage, but if I press the next or previous button the
> >> PagerTemplates dissapears.
> >> I think I have to set the BottomPagerRow property to true in another
> >> method but I don't know wich one.
>
> >> Regards,
> >> Marcelo.
> >> Alexey Smirnov escribi�:
>
> >>> On Dec 15, 8:01 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> >>> wrote:
> >>>> Hi,
> >>>> I have added a PagerTemplate to a gridview, where I can select how
> >>>> many
> >>>> records I want to show per page(20/50/100). I use this to set the
> >>>> gridview pagesize.
> >>>> The fact is that when I have 80 records to show and the gridview
> >>>> pagesize is set to 100, the PagerTemplate dissapear, and I can't set
> >>>> the
> >>>> records per page until I do a new query.
> >>>> Is there a way to set the PagerTemplate always visible?.
> >>>> In advance thanks for any help.
> >>>> Regards,
> >>>> Marcelo.
> >>> Try to set the BottomPagerRow property to true.
> >>> In addition, take a look
> >>> athttp://www.ryanmcdonnell.com/always-show-the-pagertemplate-in-gridvie...
> >>> Hope this helps- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

It tells that somewhere is an error. How did you setup the grid, is it
created in the code? Maybe you can post the complete code here...


From: Alexey Smirnov on
On Dec 17, 3:31 am, <some...(a)microsoft.com> wrote:
> Well, the error is here:
> protected void Page_Load(object sender, EventArgs e)
> {
>         gridview1.BottomPagerRow.Visible = true; //**ERROR**//
>         if (!IsPostBack)
>         {
>                 OnViewInitialized();
>           }
>     OnViewLoaded();
>
> }
>
> It looks like it can't find the BottomPagerRow at that time.
> But I don't know why...
>
> Thanks for you help.
> Regards,
> Marcelo."Alexey Smirnov" <alexey.smir...(a)gmail.com> wrote in message
>
> news:a3bc0322-f87f-4bb3-bdd2-a3fcac5e22e9(a)u20g2000vbq.googlegroups.com...
> On Dec 16, 4:13 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> wrote:
>
>
>
>
>
> > > Why did you add it into gridview1_DataBound? I think this is the
> > > problem. Try Page_Load instead
>
> > Thanks Alexey for your answer.
> > I added it into gridview1_DataBound because I found some link where it
> > said that it must be added after databinding.
> > I'm not good enough with asp.net and english yet. =)
>
> > When I try to add it to Page_Load() I receive an error:
> > System.NullReferenceException: Object reference not set to an instance
> > of an object.
>
> > Thanks again.
> > Alexey Smirnov escribió:
>
> > > On Dec 16, 3:31 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> > > wrote:
> > >> Hi again,
>
> > >> I added this method:
>
> > >> protected void gridview1_DataBound(object sender, EventArgs e)
> > >> {
> > >> gridview1.BottomPagerRow.Visible = true;
> > >> }
>
> > >> Now when the record per pages is set to 100 and the number of record of
> > >> the query is lower (80 records as an example), now the PagerTemplate
> > >> appears in the webpage, but if I press the next or previous button the
> > >> PagerTemplates dissapears.
> > >> I think I have to set the BottomPagerRow property to true in another
> > >> method but I don't know wich one.
>
> > >> Regards,
> > >> Marcelo.
> > >> Alexey Smirnov escribió:
>
> > >>> On Dec 15, 8:01 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> > >>> wrote:
> > >>>> Hi,
> > >>>> I have added a PagerTemplate to a gridview, where I can select how
> > >>>> many
> > >>>> records I want to show per page(20/50/100). I use this to set the
> > >>>> gridview pagesize.
> > >>>> The fact is that when I have 80 records to show and the gridview
> > >>>> pagesize is set to 100, the PagerTemplate dissapear, and I can't set
> > >>>> the
> > >>>> records per page until I do a new query.
> > >>>> Is there a way to set the PagerTemplate always visible?.
> > >>>> In advance thanks for any help.
> > >>>> Regards,
> > >>>> Marcelo.
> > >>> Try to set the BottomPagerRow property to true.
> > >>> In addition, take a look
> > >>> athttp://www.ryanmcdonnell.com/always-show-the-pagertemplate-in-gridvie...
> > >>> Hope this helps- Hide quoted text -
> > >> - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
>
> It tells that somewhere is an error. How did you setup the grid, is it
> created in the code? Maybe you can post the complete code here...- Hide quoted text -
>
> - Show quoted text -

Ah, I see. You should call BottomPagerRow after you binded the grid.

Like this

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
OnViewInitialized();
}
OnViewLoaded();

gridview1.BottomPagerRow.Visible = true;

}
From: Alexey Smirnov on
On Dec 17, 9:27 am, Alexey Smirnov <alexey.smir...(a)gmail.com> wrote:
> On Dec 17, 3:31 am, <some...(a)microsoft.com> wrote:
>
>
>
>
>
> > Well, the error is here:
> > protected void Page_Load(object sender, EventArgs e)
> > {
> >         gridview1.BottomPagerRow.Visible = true; //**ERROR**//
> >         if (!IsPostBack)
> >         {
> >                 OnViewInitialized();
> >           }
> >     OnViewLoaded();
>
> > }
>
> > It looks like it can't find the BottomPagerRow at that time.
> > But I don't know why...
>
> > Thanks for you help.
> > Regards,
> > Marcelo."Alexey Smirnov" <alexey.smir...(a)gmail.com> wrote in message
>
> >news:a3bc0322-f87f-4bb3-bdd2-a3fcac5e22e9(a)u20g2000vbq.googlegroups.com....
> > On Dec 16, 4:13 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> > wrote:
>
> > > > Why did you add it into gridview1_DataBound? I think this is the
> > > > problem. Try Page_Load instead
>
> > > Thanks Alexey for your answer.
> > > I added it into gridview1_DataBound because I found some link where it
> > > said that it must be added after databinding.
> > > I'm not good enough with asp.net and english yet. =)
>
> > > When I try to add it to Page_Load() I receive an error:
> > > System.NullReferenceException: Object reference not set to an instance
> > > of an object.
>
> > > Thanks again.
> > > Alexey Smirnov escribió:
>
> > > > On Dec 16, 3:31 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> > > > wrote:
> > > >> Hi again,
>
> > > >> I added this method:
>
> > > >> protected void gridview1_DataBound(object sender, EventArgs e)
> > > >> {
> > > >> gridview1.BottomPagerRow.Visible = true;
> > > >> }
>
> > > >> Now when the record per pages is set to 100 and the number of record of
> > > >> the query is lower (80 records as an example), now the PagerTemplate
> > > >> appears in the webpage, but if I press the next or previous button the
> > > >> PagerTemplates dissapears.
> > > >> I think I have to set the BottomPagerRow property to true in another
> > > >> method but I don't know wich one.
>
> > > >> Regards,
> > > >> Marcelo.
> > > >> Alexey Smirnov escribió:
>
> > > >>> On Dec 15, 8:01 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
> > > >>> wrote:
> > > >>>> Hi,
> > > >>>> I have added a PagerTemplate to a gridview, where I can select how
> > > >>>> many
> > > >>>> records I want to show per page(20/50/100). I use this to set the
> > > >>>> gridview pagesize.
> > > >>>> The fact is that when I have 80 records to show and the gridview
> > > >>>> pagesize is set to 100, the PagerTemplate dissapear, and I can't set
> > > >>>> the
> > > >>>> records per page until I do a new query.
> > > >>>> Is there a way to set the PagerTemplate always visible?.
> > > >>>> In advance thanks for any help.
> > > >>>> Regards,
> > > >>>> Marcelo.
> > > >>> Try to set the BottomPagerRow property to true.
> > > >>> In addition, take a look
> > > >>> athttp://www.ryanmcdonnell.com/always-show-the-pagertemplate-in-gridvie...
> > > >>> Hope this helps- Hide quoted text -
> > > >> - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> > It tells that somewhere is an error. How did you setup the grid, is it
> > created in the code? Maybe you can post the complete code here...- Hide quoted text -
>
> > - Show quoted text -
>
> Ah, I see. You should call BottomPagerRow after you binded the grid.
>
> Like this
>
>  protected void Page_Load(object sender, EventArgs e)
> {
>              if (!IsPostBack)
>         {
>                 OnViewInitialized();
>           }
>     OnViewLoaded();
>
>    gridview1.BottomPagerRow.Visible = true;
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Here's more info regarding this property
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.bottompagerrow.aspx

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

So, the reason of the error was that the bottom pager row was not yet
created when you call it before the GridView is bound to its data
source...