Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling a Click Event
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Handling a Click Event
Miscellaneous
Thread ID:
00852578
Message ID:
00852578
Views:
35
I know I am a newbie to .net and maybe it's just late but I am trying to handle a click event on the server side but I am having a problem.

First example works fine but it only call the js funtion and not my server side function. Here i am adding the event attribute ("onClick") to the control at ItemDataBound of my datagrid.
Private Sub TimeEntryGrid_Itembound(ByVal sender As System.Object,_
 ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
 Handles TimeEntryGrid.ItemDataBound
  
 If (e.Item.ItemType) = ListItemType.Item Or _
 (e.Item.ItemType) = ListItemType.AlternatingItem Then
       e.Item.Attributes("onClick") = "javascript:return confirm ( 'Edit this entry?' )"
 End If
 End Sub 'TimeEntryGrid_Itembound
But when I call a server side function it doesn't work, no errors.
Private Sub TimeEntryGrid_Itembound(ByVal sender As System.Object,_
 ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
 Handles TimeEntryGrid.ItemDataBound
  
 If (e.Item.ItemType) = ListItemType.Item Or _
 (e.Item.ItemType) = ListItemType.AlternatingItem Then
       e.Item.Attributes("onClick") = "clientfunction();"
 End If
 End Sub 'TimeEntryGrid_Itembound
Can I call a Server side function using JS like?
e.Item.Attributes("onClick") = "javascript:jsfunction();"
But then how do I call the Server side funtion from inside the js
<script language="javascript">
  function jsfunction()
  {
     'Call clientfunction() here?
  }
  </script>
Can I call a server function from the client in JS?
- jim durkin

"The universe is a big place, perhaps the biggest." Kurt Vonnegut
Next
Reply
Map
View

Click here to load this message in the networking platform