1. Is it possible to define an "OnDoubleClick" event attribute for a
datagrid item?
2. I have code below which selects a datagrid row with the "OnClick"
attribute, but apparently there is no built-in OnDoubleClick attribute.
Thanks.
Alan
Code - Using Datagrid Item OnClick Attribute
------------------------------------------------------
public void dgHoldings_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if( (itemType == ListItemType.Item) || (itemType ==
ListItemType.AlternatingItem) )
{
LinkButton linkButton = (LinkButton) e.Item.Cells[7].Controls[0];
e.Item.Attributes["OnClick"] = Page.GetPostBackClientHyperlink(linkButton, "
");
}
else
{
return;
}
}
________________
Alan Z. Scharf
GrapeVine Systems
New York City
Tian Min Huang - 31 Jul 2003 17:00 GMT
Hello Alan,
According to my understanding, you want to handle the doubleclick event for
LinkButton. Please correct me if there is any misunderstanding. And I'd
like to share the following information with you:
As you know, the LinkButton is interpreted as hypertext link on the client
side which supports ondblclick event. You can handle in this way:
1. In the form class:
public class WebForm1 : System.Web.UI.Page
{
......
private void Page_Load(object sender, System.EventArgs e)
{
this.LinkButton1.Attributes.Add("ondblclick", "handleDblClick()");
}
......
}
2. Add the following code in the .aspx file:
<HEAD>
......
<SCRIPT language="javascript">
function handleDblClick()
{
alert('hello');
}
</SCRIPT>
</HEAD>
Please feel free to let me know if you have any problems or concerns.
Have a nice day!
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! ?C www.microsoft.com/security
This posting is provided ??as is?? with no warranties and confers no rights.