I have the following <asp:gridview>
with one one TemplateField.
En each cell there is an image with a link and a text with a link.
It has AllowPaging=True
This is the gridview:
<asp:GridView ID="gvExperiencias" runat="server" AllowPaging="True" GridLines="None"
ShowHeader="False" AutoGenerateColumns="False" Width="650px" PageSize="4"
OnDataBinding="gvExperiencias_DataBinding"
OnPageIndexChanging="gvExperiencias_PageIndexChanging">
<PagerSettings Mode="NumericFirstLast"
FirstPageImageUrl="~/images/fle_pag_izq.gif"
LastPageImageUrl="~/images/fle_pag_der.gif"
NextPageImageUrl="~/images/fle_pag_der.gif"
PreviousPageImageUrl="~/images/fle_pag_izq.gif"
Position="TopAndBottom" PageButtonCount="4" FirstPageText=""
LastPageText="" NextPageText="" PreviousPageText="" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<div id="it_0" class="new_solo_exp_ini">
<asp:HyperLink ID="a_0" runat="server" Visible='<%# Eval("NotEmpty_0") %>'
NavigateUrl='<%# "experiencia.aspx?cod_cod=" + Eval("tttb_articulo_relacion_0.ARTCOD_ARTREL") + "&pag=" + pag + "&grp=" + Eval("idiocod_cod_idi_0") + "&cod="+cod %>'>
<asp:Image ID="Image_0" runat="server" Height="88px"
ImageUrl='<%# Eval("arigls_nom_img_0","~/ArchivosUsuario/1/1/Articulos/{0}") %>'
Width="88px" CssClass="new_image_exp_ini" />
</asp:HyperLink>
<div class="new_vineta_tit_exp_ini">
<asp:HyperLink ID="HyperLink_0" runat="server"
NavigateUrl='<%# "experiencia.aspx?cod_cod=" + Eval("tttb_articulo_relacion_0.ARTCOD_ARTREL") + "&pag=" + pag + "&grp=" + Eval("idiocod_cod_idi_0") + "&cod="+cod %>'
Text='<%# Bind("arigls_tit_0") %>'>
</asp:HyperLink>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="new_pag_bajo_exp_ini" />
<RowStyle CssClass="new_fila_exp_ini" />
</asp:GridView>
When I click the last button or the ... it goes to the corresponding page but when i click on a previous page i get the following error:
An Error Has Occurred Because A Control With Id $ContentPlaceHolder1$gvExperiencias$ctl01$ctl01' Could Not Be Located Or A Different Control Is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
So the pager does not work correctly. I think it's because of the Image's Id that has to be generated dynamically but i don't know how to do it.