HELP!DataGrid HyperLink Highlighting??

Discussion in 'ASP .Net Datagrid Control' started by steroche, Aug 24, 2005.

  1. steroche

    steroche Guest

    I have a datagrid that passes values to one page to another - well it
    actually loads up the same page again with the param passed in so i can
    poplulate another datagrid from that parameter if you know what i mean.



    My question is this: How can i make the datagrids' row highlight(like
    the way when you click select btn) and have this behaviour persist into
    the next page load?As in so i can see the 2 datagrids but i can tell
    what value i selected in the 1st grid as its now highlighted..
    Any suggestions greatly appreciated as this has been puzzling me for
    days!

    Thanks,
    Steve
    steroche, Aug 24, 2005
    #1
    1. Advertising

  2. Steve,

    If you want to immitate select btn click, add a hidden column to the
    datagrid:

    <asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
    Visible="False"></asp:ButtonColumn>

    and handle the ItemDataBound event like this:

    protected void dgUserGroup_ItemDataBound(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    ListItemType itemType = e.Item.ItemType;
    if ((itemType == ListItemType.Pager) ||
    (itemType == ListItemType.Header) ||
    (itemType == ListItemType.Footer))
    {
    return;
    }
    LinkButton button = (LinkButton) e.Item.Cells[0].Controls[0];
    e.Item.Attributes["onclick"] = this.GetPostBackClientHyperlink
    (button, "");
    }

    The example assumes the the hidden column is placed in the very first
    position in the grid.


    Eliyahu

    "steroche" <> wrote in message
    news:...
    > I have a datagrid that passes values to one page to another - well it
    > actually loads up the same page again with the param passed in so i can
    > poplulate another datagrid from that parameter if you know what i mean.
    >
    >
    >
    > My question is this: How can i make the datagrids' row highlight(like
    > the way when you click select btn) and have this behaviour persist into
    > the next page load?As in so i can see the 2 datagrids but i can tell
    > what value i selected in the 1st grid as its now highlighted..
    > Any suggestions greatly appreciated as this has been puzzling me for
    > days!
    >
    > Thanks,
    > Steve
    >
    Eliyahu Goldin, Aug 24, 2005
    #2
    1. Advertising

  3. steroche

    steroche Guest

    Thanks Eliyahu ,
    This works great for selecting anywhere iside my datagrid but is there
    any way that i can get it to work for selecting a hyperlink column
    aswell? I am selecting a column, passing the paramaters to the same
    page again so that i can populate the datagrid form that value and it
    would be niceif i could make the row highlight when i do this.
    Thanks,
    Steve
    steroche, Aug 26, 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. davetichenor
    Replies:
    1
    Views:
    803
    Eliyahu Goldin
    Oct 30, 2006
  2. steroche

    HELP!DataGrid HyperLink Highlighting??

    steroche, Aug 24, 2005, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    97
    steroche
    Aug 26, 2005
  3. steroche

    DataGrid HyperLink Highlighting??

    steroche, Aug 24, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    86
    steroche
    Aug 24, 2005
  4. Dave
    Replies:
    0
    Views:
    922
  5. steroche

    HELP!DataGrid HyperLink Highlighting??

    steroche, Aug 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    104
    steroche
    Aug 26, 2005
Loading...

Share This Page