"This articles can be helpful to you: MSDN: Selecting Rows by Clicking Anywhere" Regarding the article referenced above, how would I cause the row and/or column to remain colored once a any cell is clicked? How about this:
private void DataGrid1_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;
}
// what is this doing?
LinkButton button = (LinkButton)e.Item.Cells[0].Controls[0];
e.Item.Attributes["onclick"] =
Page.GetPostBackClientHyperlink(button, "");
//something like this next?
e.Item.Attributes.Add("onclick", "this.style.backgroundColor='Silver'")
//how to highlight column as well and how to remove on next other column click?
}
dichiee
Member
65 Points
13 Posts
Is it possible to the whole row a hyperlink?
Jul 02, 2003 09:37 PM|LINK
SushilaSB
Star
11417 Points
2265 Posts
Re: Is it possible to the whole row a hyperlink?
Jul 03, 2003 01:27 AM|LINK
Visual ASP/ASP.NET MVP
http://weblogs.asp.net/sushilasb
zlvilla
Member
20 Points
4 Posts
Re: Is it possible to the whole row a hyperlink?
Jul 03, 2003 03:51 AM|LINK
Colt
All-Star
15569 Points
1986 Posts
ASPInsiders
MVP
Re: Is it possible to the whole row a hyperlink?
Jul 03, 2003 04:06 AM|LINK
SushilaSB
Star
11417 Points
2265 Posts
Re: Is it possible to the whole row a hyperlink?
Jul 03, 2003 01:38 PM|LINK
Visual ASP/ASP.NET MVP
http://weblogs.asp.net/sushilasb
dichiee
Member
65 Points
13 Posts
Re: Is it possible to the whole row a hyperlink?
Jul 03, 2003 02:47 PM|LINK
dichiee
Member
65 Points
13 Posts
Re: Is it possible to the whole row a hyperlink?
Jul 03, 2003 05:33 PM|LINK
<asp:DataGrid ID="DataGrid1" ItemStyle-BorderStyle=None BorderStyle=None BorderWidth=0 Wrap=false Width="100%" AutoGenerateColumns="False" EnableViewState="False" Runat="Server"> Date Name Message ">wireless
Member
440 Points
88 Posts
Re: Is it possible to the whole row a hyperlink?
Aug 26, 2003 10:57 PM|LINK
private void DataGrid1_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; } // what is this doing? LinkButton button = (LinkButton)e.Item.Cells[0].Controls[0]; e.Item.Attributes["onclick"] = Page.GetPostBackClientHyperlink(button, ""); //something like this next? e.Item.Attributes.Add("onclick", "this.style.backgroundColor='Silver'") //how to highlight column as well and how to remove on next other column click? }