all groups > asp.net datagrid control > august 2005 >
You're in the

asp.net datagrid control

group:

HELP!DataGrid HyperLink Highlighting??



Re: HELP!DataGrid HyperLink Highlighting?? Eliyahu Goldin
8/24/2005 12:00:00 AM
asp.net datagrid control: 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

[quoted text, click to view]

HELP!DataGrid HyperLink Highlighting?? steroche
8/24/2005 6:11:19 AM
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
AddThis Social Bookmark Button