Ver Mensaje Individual
  #12 (permalink)  
Antiguo 05/05/2005, 09:22
Avatar de neivan
neivan
 
Fecha de Ingreso: febrero-2005
Mensajes: 539
Antigüedad: 20 años, 1 mes
Puntos: 1
Enlazar checbox con javascript

He leido en otro tema un respuesta de rootk

Por último hay que asociar el code javascript a el control checkbox.. eso lo podemos hacer con el evento ItemDataBound y quedaría de ésta forma:
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound

If e.Item.ItemType = ListItemType.AlternatingItem Or _
e.Item.ItemType = ListItemType.Item Then
Dim chkBox As CheckBox = CType(e.Item.FindControl("CheckBox1"), CheckBox)
'Le asocio el evento onlick y le paso como parametro el objeto actual
chkBox.Attributes.Add("onclick", "unCheck(this)")
End If

End Sub

Es necesario hacer el enlace asi???
no se puede utilizar = onchanged='javascript:registrar(<%# databinder.eval(container.dataItem , "id" ) %>)'