Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Amigos,
Eu trenho um databound de uma dridview e gostaria de criar um "link" que chamasse uma função após isso.
Exemplo:
Protected Sub gvEtapa_rowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvEtapa.RowDataBound
If e.Row.RowType = ListItemType.Item Or e.Row.RowType = ListItemType.AlternatingItem Then
Dim retorno As String = ""
e.Row.Style("cursor") = "hand" ' Cursor
'muda de cor a celula
e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#D7D8B8';")
e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='';")
If gvEtapa.Columns.Count > 1 Or gvEtapa.AutoGenerateColumns Then
e.Row.Attributes.Add("onClick", "java script:txtCodCons.value=" & e.Row.Cells(0).Text & ";" & Page.GetPostBackEventReference(Carregadetalhes(1)))
'& ClientScript.GetPostBackEventReference(, ""))
e.Row.Cells(0).Text = "<a href='#'>" & e.Row.Cells(0).Text & "</a> "
End If
End If
End Sub
Private Sub Carregadetalhes(ByVal idDetalhe As Long)
Dim rows() As DataRow
Dim ds As New DataSet
Dim dt As New DataTable("Tabela")
dt = dsCabecalho.Tables(1).Clone
ds.Tables.Add(dt)
Try
rows = dsCabecalho.Tables(1).Select("idCDVENAtt = " & idDetalhe.ToString)
For Each r As DataRow In rows
ds.Tables(0).ImportRow®
Next
gvEtapaItem.DataSource = ds
gvEtapaItem.DataBind()
Catch ex As Exception
Mensagem(ex.Message)
End Try
End SubCarregando comentários...