I posted this yesterday but did not have any account information. I'll try again today.
Basically, I have some Asp.net Server Side logic for IsDirty checking. To check and see if the web page is dirty (data has changed). I have added some code to my master page to work with all pages. I have implemented this code in one page and everything is working fine. However, with the RadGrid control I'm seeing some issues with the CurrentPageIndex when manually setting this page in c# code.
Code:
case "RADGRIDVIEW":
{
RadGridView rgv = (RadGridView)childControl;
int saveCurrentPageIndex = rgv.CurrentPageIndex;
EventArgs e = new EventArgs();
for (int p = 0; p < rgv.PageCount; p++)
{
rgv.CurrentPageIndex = p;
rgv.Rebind();
for (int r = 0; r < rgv.Items.Count; r++)
{
for (int c = 0; c < rgv.Items[r].Cells.Count; c++)
{
controlValues.Append(rgv.ClientID);
controlValues.Append(
"_Pg" + p + "Row" + r + "Col" + c);
controlValues.Append(
":");
controlValues.Append(rgv.Items[r].Cells[c].Text);
controlValues.Append(
",");
}
}
}
rgv.CurrentPageIndex = saveCurrentPageIndex;
//Reset page to saved page index.
rgv.Rebind();
break;
}
Ok, so now I call this code in a method to build the initial string of control ID and data. I this case I'm cycling through the RadGrid (we inherit from RadGrid to create RadGridView) cells to build the string in a string builder. First time through this code the grid is empty. Second time the grid has 11 records in two page. The second time the grid is cycled through this code works fine and all 11 records are added to the string builder. The a submit button is clicked and the same code is called to create a comparison string builder object. However, this time the code (in debug mode) works a little different. This time the page is set to index 0 (page 1) and it has 10 record in the page. Everything is ok. Then when page index (rgv.CurrentPageIndex) is set to 1 for page 2. When the debug step is looking at the rgv.Items.Count it still says 10 records (rows). The code again adds the ten records to the string builder. It's like the page did not really change. Ok, now last night I tried to do the same thing but this time I moved the page to page 2. Then did the same code 1, 2 and 3 times. This time the code worked the same way on pass 1 and 2. But on 3rd pass the page 1 (index 0) had one record (row) and on the 2nd page it to had the same one record.
Please let me know if here is an issue with this control (RadGrid) or if I'm doing something wrong! Thanks!
JerryM (using Pradeeps account!)