Re: Click anywhere in a row....
- From: "Eliyahu Goldin" <removemeegoldin@xxxxxxxxxxxxxx>
- Date: Thu, 12 May 2005 15:36:48 +0200
There is a number of ways. The easiest one (C# syntax):
Add a hidden button column:
<asp:datagrid id=myGrid runat="server" AutoGenerateColumns="False"
OnItemDataBound="myGrid_ItemDataBound" >
<Columns>
<asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
Visible="False"></asp:ButtonColumn>
<asp:BoundColumn DataField="user_nm" HeaderText="Logon
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="last_nm" HeaderText="Last
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="first_nm" HeaderText="First
Name"></asp:BoundColumn>
</Columns>
</asp:datagrid>
and setup an ItemDataBound event handler:
protected void myGrid_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, "");
}
Eliyahu
"UJ" <fred@xxxxxxxxxxx> wrote in message
news:ObclumuVFHA.132@xxxxxxxxxxxxxxxxxxxxxxx
> Is there any way to tell when a user clicks anywhere in a row? The only
way
> I can think to do it is to make each column a link with a button and use
the
> text as the value I want displayed.
>
> TIA.
>
>
.
- References:
- Click anywhere in a row....
- From: UJ
- Click anywhere in a row....
- Prev by Date: RE: EditCommandColumn - how to know if user changed data...
- Next by Date: Re: Printing Datagrid
- Previous by thread: Re: Click anywhere in a row....
- Next by thread: Re: Printing Datagrid
- Index(es):