Reputation: 1005
The problem is this, I have a DG which i have it on paging true but when I click the, next page it retrieves the correct records but does not change the selected link. This is like, if I click on page two it gets the page two records but the link stays marked as page 1 I need to click it again to get the 2 blackened.
The code:
read = Con.executar_re(strConsultaPagina);
DataSet dsPaginas = read;
dataGridStatusOficio.DataSource = dsPaginas.Tables[0];
dataGridStatusOficio.DataBind();
dataGridStatusOficio.CurrentPageIndex = e.NewPageIndex;
strCo... is the string
"Select Id,DocNum,Note,Date,ReceiverDate,Status,TypeCCompany,Receiver,SigantureDoc,SignaturePosition,Prior,TypeCDocument,InputOutput FROM Oficios_dev2.dbo.doc WHERE DocNum like '%" + txtBuscarNumero.Text.Trim() + "%' and DocNum like '%" + Convert.ToString(Session["Level"]) + "%' "
The lines are in the:
protected void dgStatus_changeIndex(object source, DataGridPageChangedEventArgs e)
I know is not the most elegant way of doing this, as I'm calling the SQL every time it changes page, but this has a lot of that code that is impossible to not have to get your hands dirty, so can anybody help me with this.
Thanks.
Upvotes: 0
Views: 63
Reputation: 2012
I would change this..
dataGridStatusOficio.CurrentPageIndex = e.NewPageIndex;
to this
dataGridStatusOficio.PageIndex = e.NewPageIndex;
and see if this solves your problem. Let me know if this helps!
Upvotes: 1