|
Rank: Newbie Groups: Member
Joined: 7/11/2009 Posts: 8
|
Dear Sir,
I have a grid with about 50 rows. So, if i want to edit 45th row, I click "Select" and trigger ItemChanged to query value and put under TextBox on same pages. Then, I did some edit, and click ASP:button save. The whole page reload and the grid go back to Row 1.
How we can get the grid row selected position that stop at 45th rows ? Thanks !!!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, We are not exactly sure about your scenario and your steps to reproduce the problem. It will be better for you to post a test page demonstraging the problem. The Grid should automatically save the current selected item when you post back. The value is stored in SelectedItemIndex property. If you rebind the Grid, this value will be reset and the Grid will go back to row 1. In this case you can store the previous SelectedItemIndex and then restore it again after you rebind the Grid. However you will also need to consider that the number of row may changes and the old SelectedItemIndex may be out of range. So you will need to code to handle that situation. Currently the Grid does not automatically scroll a selected item into view. For example, if the Grid has 40 rows and only the first 20 rows are visible when the Grid's scroll position is on the top, the selected item won't be visible if it is the 30th row because the Grid does not automatically scrolls. We may add this in our next release. In the mean time you can use our client side JavaScript interface to make it visible:
Code: HTML/ASPX
<eo:Grid ClientSideOnLoad="on_grid_loaded" .....>
.....
</eo:Grid>
Code: JavaScript
function on_grid_loaded()
{
//Get the grid object. NOTE: the code should be
//<%=Grid1.ClientID%>, not "<%=Grid1.ClientID%>"
var grid = eo_GetObject("<%=Grid1.ClientID%>");
//Get the grid item. NOTE: the code should be
//<%=Grid1.SelectedItemIndex%>, not
//<%=Grid1.SelectedItemIndex%>
var item = grid.getItem("<%=Grid1.SelectedItemIndex%>");
//Scroll the item into view
if (item)
item.ensureVisible();
}
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/11/2009 Posts: 8
|
Thank you for your prompt reply !! You got my point, but your code doesnt work. Hopefully your next release will include this function.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The code should work. However you can not copy and paste as is. You will need to modify the IDs accordingly. Also you need to read the comment and change "<" to "<". The actually content should be "<", however it is incorrectly formatted as "<" during the code coloring process.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/11/2009 Posts: 8
|
Hi, Understand your point. I will try it again.
|
|