HOWTO: Bring that row back into focus ...

S

So

HOWTO: Bring that row (in a grid) back into focus, on which a hyperlink was
clicked to navigate to Detail page.

Hi everybody,
There is a grid control on page with a hyperlink column. On clicking on of
the hyperlinks a details page is shown. The details page has a Back or
Cancel button. On clicking either of these the List page will appear. <Huh,
a common everyday scenario>. Now the thing is, how do I bring that same row
into focus on which the hyperlink was clicked, without having to scroll down
everytime I get back to the List page with the grid control.
TIA
 
G

guillaume StEtienne FR

I think the only way is to use some personnal JavaScript code. 'cos it's a
client-side functionnality.
Use that kind of dhtml client code:
<script>
.....
myHtmlLink.focus();

</script>

in this script area, you have to reference your html link object with:

myHtmlLink = document.GetElementById( idGeneratedByServerWebControl );

remember that this client script code is generated by your server-side code
( in the code behind or the aspx file).
then, to know the ID of the client-side object that represent your hyperlink
(A tag), use some code (server side) that will tell the client Jscript what
is its name:

Response.Write ( "idGeneratedByServerWebControl =" +
myHyperLinkServerSideControl.ClientID);

hope it will hep...
 
S

So

Thanks for your reply. I got it working by doing something like this:

In the Page_load of the page where this Grid List is, at the end

strFocusScript = "<script language='javascript'>"
strFocusScript = strFocusScript & "if (document.all('" & hlnk1.ClientID
& "')!=null) document.all('" & hlnk1.ClientID & "').focus()"
strFocusScript = strFocusScript & "</script>"
RegisterStartupScript(hlnk1.ClientID, strFocusScript)

where hlnk1 is initialized from the first column (a hyperlink one) of the
row that
has matching code returned back from the Details Page.

hlnk1 = CType(grd1.Items(i).Cells(0).Controls(0), HyperLink)


"guillaume StEtienne FR" <[email protected]>
schrieb im Newsbeitrag
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top