HOWTO: Bring that row back into focus ...

Discussion in 'ASP .Net Datagrid Control' started by So, May 3, 2005.

  1. So

    So Guest

    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
     
    So, May 3, 2005
    #1
    1. Advertising

  2. 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
    >
    >
    >
     
    guillaume StEtienne FR, May 4, 2005
    #2
    1. Advertising

  3. So

    So Guest

    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" <>
    schrieb im Newsbeitrag
    news:...
    > 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
    > >
    > >
    > >
     
    So, May 13, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. So

    HOWTO: Bring that row back into focus ...

    So, May 3, 2005, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    146
  2. Replies:
    0
    Views:
    120
  3. So

    HOWTO: Bring that row back into focus ...

    So, May 3, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    138
  4. Dwayne Epps

    bring focus to text field on submit

    Dwayne Epps, Jul 16, 2003, in forum: Javascript
    Replies:
    0
    Views:
    191
    Dwayne Epps
    Jul 16, 2003
  5. Dai Ba Wong
    Replies:
    3
    Views:
    171
    kaeli
    Jul 6, 2004
Loading...

Share This Page