From: someone on
My solution was to add the following pagertemplate:

//***
<PagerTemplate>
<asp:Label ID="Label1" runat="server" Text="Show Rows:" />
<asp:DropDownList CssClass="LetraNormal" ID="RegsPag"
runat="server" AutoPostBack="true"
OnSelectedIndexChanged="RegsPag_SelectedIndexChanged">
<asp:ListItem Value="20" />
<asp:ListItem Value="50" />
<asp:ListItem Value="100" />
</asp:DropDownList>
&nbsp;
Page
<asp:TextBox ID="IraPag" runat="server" AutoPostBack="true"
OnTextChanged="IraPag" CssClass="irapag" />
of
<asp:Label ID="lblTotalNumberOfPages" runat="server" />
&nbsp;
<asp:Button ID="Button4" runat="server" CommandName="Page"
ToolTip="First Page" CommandArgument="First" CssClass="primero" />

<asp:Button ID="Button1" runat="server" CommandName="Page"
ToolTip="Prev. Page" CommandArgument="Prev" CssClass="anterior" />
<asp:Button ID="Button2" runat="server" CommandName="Page"
ToolTip="Next Page" CommandArgument="Next" CssClass="siguiente" />

<asp:Button ID="Button3" runat="server" CommandName="Page"
ToolTip="Last Page" CommandArgument="Last" CssClass="ultimo" />
</PagerTemplate>
//***


And the following code:

//**
protected void RegsPag_SelectedIndexChanged(object sender,
System.EventArgs e)
{
//CAMBIAR NUMERO DE FILAS A MOSTRAR
//OBTIENE EL NUMERO ELEGIDO
DropDownList _DropDownList = (DropDownList)sender;
//CAMBIA EL PAGESIZE DEL GRID ASIGNANDO EL ELEGIDO
this.gridview1.PageSize =
int.Parse(_DropDownList.SelectedValue);
this.gridview1.PageIndex = 0;
}

protected void gridview1_RowDataBound(object sender,
System.Web.UI.WebControls.GridViewRowEventArgs e)
{
// FORMATEA GRID
if (e.Row.RowType == DataControlRowType.Pager)
{
//ASIGNAMOS VALORES A NUMERO DE PAGINA ACTUAL Y TOTAL
PAGINAS
Label _TotalPags =
(Label)e.Row.FindControl("lblTotalNumberOfPages");
_TotalPags.Text = gridview1.PageCount.ToString();
TextBox _IraPag = (TextBox)e.Row.FindControl("IraPag");
_IraPag.Text = (gridview1.PageIndex + 1).ToString();
//ASIGNA AL DROPDOWNLIST COMO VALOR SELECCIONADO EL
PAGESIZE ACTUAL
DropDownList _DropDownList =
(DropDownList)e.Row.FindControl("RegsPag");
_DropDownList.SelectedValue =
this.gridview1.PageSize.ToString();
}
}

protected void IraPag(object sender, System.EventArgs e)
{
//CAMBIO DE PAGINAS
TextBox txtGoToPage = (TextBox)sender;

int pageNumber;
if (int.TryParse(txtGoToPage.Text.Trim(), out pageNumber)
&& pageNumber > 0 && pageNumber <= this.gridview1.PageCount)
{
this.gridview1.PageIndex = pageNumber - 1;
}
else
{
this.gridview1.PageIndex = 0;
txtGoToPage.Text = "1";
}

}

protected void gridview1_DataBound(object sender, EventArgs e)
{
gridview1.BottomPagerRow.Visible = true;
}

protected void gridview1_PreRender(object sender, EventArgs e)
{
GridView grid = (GridView)sender;
switch (grid.PagerSettings.Position)
{
case PagerPosition.Bottom:
grid.BottomPagerRow.Visible = true;
break;
case PagerPosition.Top:
grid.TopPagerRow.Visible = true;
break;
case PagerPosition.TopAndBottom:
grid.BottomPagerRow.Visible = true;
grid.TopPagerRow.Visible = true;
break;
}


}
//**

I think it's working as I espected.
Now I just need to add a checkbox, to let the user decide if he/she
wants to paginate the result or not.

Regards,
Marcelo.

Alexey Smirnov escribi�:
> On Dec 18, 3:47 am, <some...(a)microsoft.com> wrote:
>> I added this and now it's working ok:
>> protected void gridview1_PreRender(object sender, EventArgs e)
>> {
>> GridView grid = (GridView)sender;
>> switch (grid.PagerSettings.Position)
>> {
>> case PagerPosition.Bottom:
>> grid.BottomPagerRow.Visible = true;
>> break;
>> case PagerPosition.Top:
>> grid.TopPagerRow.Visible = true;
>> break;
>> case PagerPosition.TopAndBottom:
>> grid.BottomPagerRow.Visible = true;
>> grid.TopPagerRow.Visible = true;
>> break;
>> }
>>
>> I have another problem now that is when I change from 50 record per pages
>> (viewing page3) to 100 records per pages (87 records so only have 1 page),
>> in this case the current page number dissapear, but this is another problem
>> I have to analyze. I meant it has to show "viewing page 1 of 1" but it's
>> showing "viewing page of "
>> I will try to put the code...
>>
>> Regards,<some...(a)microsoft.com> wrote in message
>>
>> news:%23g7SHQ3fKHA.2188(a)TK2MSFTNGP04.phx.gbl...
>>
>>
>>
>>> Hi Alexey,
>>> The solution didn't work.
>>> There must be another place to set the property...
>>> Thanks a lot for your help.
>>> Regards,
>>> "Alexey Smirnov" <alexey.smir...(a)gmail.com> wrote in message
>>> news:82870d23-2ad0-4ffb-a41a-850e64780d52(a)r24g2000yqd.googlegroups.com...
>>> On Dec 17, 2:01 pm, "some...(a)microsoft.com" <some...(a)microsoft.com>
>>> wrote:
>>>> Alexey Smirnov escribi�:
>>>>> 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;
>>>>> }
>>>> Hi Alexey, (Excuse me I sent this to your personal email by error)
>>>> If I put it there I think is called just when the page is loaded, but
>>>> not when I press the next or previous button, I think this is because de
>>>> gridview is in a updatepanel, so not all the page is updated when I
>>>> change the page number.
>>>> Is there any other place where I can put the method to be called
>>>> everytime I change the page?
>>>> Thanks a lot for your time.
>>>> Regards,
>>>> Marcelo.- Hide quoted text -
>>>> - Show quoted text -
>>> I think i got it, do you have gridview1_SelectedIndexChanged method?
>>> You need to put gridview1.BottomPagerRow.Visible = true there- Hide quoted text -
>> - Show quoted text -
>
> If I were you I would add a label and put my custom text there. It's
> ugly to see "page 1 of 1", and even "page 1" makes no sense to me
> because there is no other page. Again, what happens if result returns
> no records? It will be again the same situation either "page 1 of 0"
> or no text at all... I would do following
>
> if (gridview.rows.count == 0)
> label.text = "nothing found"
> else if if (gridview.rows.count < pagesize)
> label.text = "page 1"
> else if if (gridview.rows.count > pagesize)
> label.text = "page x of y"