vamsikiran kolla
vamsikiran kolla

Reputation: 71

Button onclick event in VB

I'm trying to build a cell within a table . The cell is going to be a button which should open the hyperlink(An email address) .How do i write the onclick event

Below is the code in VB for the cell that i'm building

 newCell = New TableCell
                newCell.ID = "celRptSelect" & rptRow & "F"
                newCell.Style("width") = rowRptSelectHeadF.Style("width")
                newCell.CssClass = "TableButton"
                newCell.Text = "SME"
                newCell.Attributes.Add("onclick", "rpt.SmeEmail")
                newCell.Attributes.Add("runat", "server")
                newRow.Cells.Add(newCell)

rpt.SmeEmail is the data that i'm getting from database

Thanks in advance

Upvotes: 2

Views: 810

Answers (1)

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28970

You can use this code

newCell.Attributes.Add( "onclick", "CellAction( me )" );

Add your script

<script type="text/vbscript">
Sub CellAction( tdControl )
  MsgBox tdControl.id
End Sub
</script>

Upvotes: 2

Related Questions