2

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

1
  • Still looking for help on this . Commented Jul 18, 2013 at 16:16

1 Answer 1

2

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>
Sign up to request clarification or add additional context in comments.

3 Comments

I'm not sure how i can use the code provided. can you be more elaborate on how i can use it please
In code behind - newCell.Attributes.Add("onclick", "CellAction( me )")
In Page <script type="text/vbscript"> Sub CellAction(rowRptSelectHeadF) MsgBox rowRptSelectHeadF.id; End Sub </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.