سؤال

Can anyone tell me how I would get the data from a row in a DataGrid after a page changes. I am currently trying the following:

protected void MissionariesGrid_PageIndexChanged(object sender, EventArgs e)
{
    string missionaryID = MissionariesGrid.Rows[0].Cells[0].Text;
    TestLabel.Text = missionaryID;
}

The problem is, I do not get the value for the first row in the new page. I am getting the value for the first row in the old page.

هل كانت مفيدة؟

المحلول

Your logic for that should be in the RowCreated or RowDataBound event handler... The PageIndexChanged happens too soon I think.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top