Double-click Event Attribute on Datagrid Item

A

Alan Z. Scharf

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
 
T

Tian Min Huang

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top