Home All Groups Group Topic Archive Search About

HOWTO: Bring that row back into focus ...

Author
3 May 2005 8:14 AM
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

Author
4 May 2005 8:50 AM
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...


Show quoteHide quote
"So" wrote:

> 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
>
>
>
Author
13 May 2005 1:31 PM
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" <guillaumeStEtienn***@discussions.microsoft.com>
schrieb im Newsbeitrag
Show quoteHide quote
news:AC4289AF-7192-45EC-96B5-D945CDD67991@microsoft.com...
> 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...
>
>
> "So" wrote:
>
> > 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
> >
> >
> >