views:

671

answers:

2

Guys, I’ve been writing code for 15+ years, but managed to avoid “Web Development” until 3 months ago.

I have inherited a legacy Asp.net application (started in .net 1.1, we’re now on .Net 2.0), it’s the administration tool for our product.

In several places the admin tool simply maintains long lists of values.

The list (could be 200+ items) appear in a GridView (Page A), user clicks an edit button for an item, this brings them to an edit page for the item (Page B) where they can change the value (or values, an item in the list may be associated with several values e.g. name and address and preferred colour, breed of cat . . .)

Currently when the user presses “Save” on Page B, we redirect back to Page A. The page opens at the top of the list, this annoys the user as often several items in sequence will need to be configured together, and the user needs to 1. Remember which item they just edited, 2. scroll down to that item

What I want to do is have the list bring the user back to the item they just edited, as often several items in sequence will need to be configured together.

Fastest Gun Stop . . . and keep reading

  1. Suggestions on the lines of “regroup the items so there are fewer in the list” will be considered unhelpful
  2. Valid points that .Net 3.5 does this automatically, will be considered unhelpful by me (but post them anyway, it may help some other poor fool)
  3. I think I could do this by posting the Id of the edited item when re-loading Page A, and scrolling the grid to this point, however My Question is . . .

Is there a feature to do this that I don’t know about (and what is it) and/or
What is the accepted way of doing this?

Thanks in advance B. Worrier

+1  A: 

The simplest way you can do is to pass back an id from PageB in the querystring in the URL while redirecting back to PageA after saving in PageB.

e.g. www.example.com/PageA.aspx?editedId=89

and in PageLoad of PageA, you can check if this is from the editing detail page by examineing whether there is a valid value in HttpContext.Current.QueryStrubg["editedId"], if there was, it means it is from PageB. You can use this value to highlight or select the row in the datagrid easily

Fastest Gun Stop . . . and keep reading...

A good control allows you to edit multiple rows at the same time on same page for example on PageA, and save them together. Check you Telerik control for datagrid. You'd love it.

codemeit
+3  A: 

This could be achieved using Anchor Tags. When you output your elements on Page A, set an anchor tag next to each element like follows:

<a name="#175"></a>

Where this item would be item id 175. Then when you redirect back to PageA, add a "#175" onto the end of the url

Response.Redirect("PageA.aspx#175");
WebDude
@WebDude, thanks, but setting the Anchor tag should be <a name="175"></a>
Binary Worrier