Returning scrolling DataSets to selected item after re-post

G

GKutcher

Greetings, all!! This is my first post!

The situation I have is as follows: a web service application where 6
datagrids reside on one page. These grids are related in a hierarchical
fashion thusly:

grid 6 depends on grid 5
grid 5 depends on grid 3
grid 4 depends on grids 2 and 3
grids 2 and 3 depend on grid 1

Therefore, selecting an item in grid 1 will dynamically populate grids 2 &
3, which default to their first item and dynamically populate grids 4 and 5,
which finally populates grid 6. Selecting an item in any grid except 6 will
- if data are present - result in the re-popalution of later grids according
to the relationships.

The method for returning a scrolling datagrid to the selected item, instead
of to the top, is fairly well covered online. But I have an entirely
different situation.

If I select, for example, an item in grid 4 that is the child of any item in
grids 1, 2 or 3 that have to be scrolled to be viewed, the methods I have
found will apply ONLY to grid 4, where that selected item will remain in
view, but the selected items in the earlier grids will vanish from view as
the page re-loads. The following is a snippet that should give an idea of
what I am doing: it is being called for each datagrids' SelectedItemChanged
event.

/* code snippet below ensures that datagrid remains with selected item in
view, instead of scrolling to the top*/

LinkButton editButton = new LinkButton();
editButton = (LinkButton)dataEleGrid.SelectedItem.Cells[10].Controls[0];
editButton.Attributes.Add("name", editButton.UniqueID);
string targetItem = editButton.Attributes["name"].ToString();

string startUpScript = "";
startUpScript = "<script language=Javascript>location.href='#" + targetItem
+ "';</script>";

this.RegisterStartupScript(dataEleGrid.SelectedItem.UniqueID + "StartUp",
startUpScript);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top