I have defined the client-side click event for a link in the code-behind of an ASP.Net page. This code is in VB.Net as below and it uses Attributes collection of link control to add this client-side event. This event is executing as expected, but I cannot get a handle on the `event' argument for stopping event propgation.
Question
How can I access the event argument so that the stopPropagation method can be called to prevent the click event of a parent div from firing?
Dim link As System.Web.UI.WebControls.LinkButton = DirectCast(sender,
System.Web.UI.WebControls.LinkButton)
link.Attributes.Add("onclick", "OnEmployeeClick('" &
dataRowItem("EmployeeId").ToString() & "','" & link.ClientID & "');
return false; ")
UPDATE 1
As suggested by dandavis, I simply used the automatically available event argument, and it worked. I added new code of event.stopPropagation(); just before the OnEmployeeClick method call in the onclick definition in code-behind.
Dim link As System.Web.UI.WebControls.LinkButton = DirectCast(sender,
System.Web.UI.WebControls.LinkButton)
link.Attributes.Add("onclick", "event.stopPropagation();OnEmployeeClick('" &
dataRowItem("EmployeeId").ToString() & "','" & link.ClientID & "');
return false; ")
eventusually (browsers insert the name in inline events for you), or asarguments[0]alwayseventargument is automatically available? if yes, is this a cross-browser thing?