Welcome Guest Search | Active Topics | Sign In | Register

Maintaining Scroll Position on Grid after Postback Options
RichGoodin
Posted: Friday, January 8, 2010 8:03:09 PM
Rank: Newbie
Groups: Member

Joined: 1/2/2010
Posts: 1
I have created a page with a grid that contains a dropdown list column. When the user changes the selection in the dropdown list, the new value is used to postback to the server and the database is updated. Everything is working fine with one exception. If the user scrolls down the grid and makes a change, the scroll position of the grid is not maintained after the postback. It makes it very difficult for the uer to keep track of his position in the grid. How can I maintain the scroll position of the grid?
eo_support
Posted: Friday, January 8, 2010 8:34:16 PM
Rank: Administration
Groups: Administration

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

The easiest way to achieve this is to turn the full page post back into a partial page post back (AJAX). This way your will be calling back to the server (thus update your DB) without reloading the Grid. Here are the basic steps:

1. Place an EO.Web ScriptEvent control into the form;
2. Place an empty CallbackPanel into the form;
3. Set the ScriptEvent as a trigger for the CallbackPanel;
4. Code your DropDownList to call the following code when user selects a value:

eo_TriggerServerEvent("ScriptEvent1", "whatever", "your_new_value");

You will need to change the first argument to the ID of the ScriptEvent control and the third element to the new value that you would like to pass to the server (to save to the DB).

5. Handle the ScriptEvent's server side Command event. Inside that event handler you can update your DB based on the event arguments. "whatever" is passed as CommandName, "your_new_value" is passed as CommandValue;

This way when user selects a drop down list item, eo_TriggerServerEvent is called to trigger a server event on the ScriptEvent control, which is rerouted through the CallbackPanel. In the end you would handle the ScriptEvent's control's server event without reloading the Grid. The second and third argument of eo_TriggerServerEvent is completely up to you. You can pass any value back to the server through these two arguments.

Hope this helps.

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.