Welcome Guest Search | Active Topics | Sign In | Register

Web Grid: Index out of range error Options
Roger Jordan
Posted: Monday, April 7, 2014 6:05:53 AM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
Hi,
I get a realy strange error with EO.Web.Grid.

I have two pages, both using the same MasterPage. I put a EO.Web.Grid on each page. The columns are a little bit different. The grids on each pages have the ID "Grid1".

In the page load event of the first page I fill a datatable with one row, set the DataSource property and bind this datatable to the grid. This works.
Now I put a button on the first page (the start page). This button redirects to the second page with the other grid. Clicking on the button to redirect to the second page results in an "Index out of range" error. I have no idea whats wrong.

This error does not occur if
- no MasterPage is used
- no DataSource is set and bind on the first page
- both grids have the same columns
And realy strange:
If only the ID of the grid on the second page is set to "Grid2" instead of "Grid1" it works.

I can send you an example Project.

Thanks for any help.

Regards,
Roger


eo_support
Posted: Monday, April 7, 2014 11:27:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Can you send us a test project? We tried to follow your steps at here but we could not reproduce the problem. We will PM you as to where to send the test project.

Thanks!
eo_support
Posted: Monday, April 7, 2014 3:55:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Thank you for the test project. We have looked into the project. The problem is because you are doing a cross page post back from the first page to the second page. This requires your second page to be able to properly interpret whatever state data information saved by the first page. And of course, when certain controls or settings on a control does not match the original page who saved the state data, you will get an invalid state data error. Usually the second page can just safely ignore the error ---- for example, if there is a Button1 in the first page that saved some data but there is no Button1 in the second page, then that piece of the state data can just be safely ignored. The same can occur inside a control. For example, a Grid might save a "current editing row index" data and pass this to the second page, but the Grid in the second page is readonly, so that can be safely ignored as well. But it is possible that the control in the second page can not safely ignore the mismatched data. In that case an error occurs. When that occurs, you must adjust your page so that the control match. Fixing this kind of error is like trying to "fix" a car so that it can run just fine on a flat tire. It doesn't make much sense for us to do so.

Thanks!
Roger Jordan
Posted: Tuesday, April 8, 2014 2:19:42 AM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
Hi,

thanks for your Support. I understand what happens, so rename the control should fix this problem for me. Or instead use Response.redirect().

Many thanks for your great support!

Regards,
Roger
eo_support
Posted: Tuesday, April 8, 2014 8:39:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Yes. The "normal" way would be to let the page to post back to the original page and then use Response.Redirect to redirect to the new page.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.