HTML Table Event

Last post 10-13-2008 3:06 PM by NC01. 2 replies.

Sort Posts:

  • HTML Table Event

    10-13-2008, 12:23 AM
    • Member
      17 point Member
    • alvinblim
    • Member since 05-22-2007, 9:34 AM
    • Posts 32

    i am using the following code to add a button in table cell.

    Dim tr As New TableRow

    Dim tc As New TableCell

    table1.rows.add(tr)

    tr= new table row

    dim button1 as new button

    button1.ID = "btnTest1"

    button1.text="abc"

    tc.control.add(button1) 

    tr.cell.add(tc)

    after add the button into the table, i need to insert event into the button. when click the button, the system will call the module or function. How can i insert the call function into that button?

    Thank you

  • Re: HTML Table Event

    10-13-2008, 4:25 AM
    Answer
    • Contributor
      2,324 point Contributor
    • susain
    • Member since 10-29-2007, 11:51 AM
    • Hyderabad, Andhra Pradesh, India
    • Posts 646
    Linked In: http://www.linkedin.com/in/mohammedfarooq123

    Mark as answer if this post help full to you.
  • Re: HTML Table Event

    10-13-2008, 3:06 PM
    Answer
    • All-Star
      76,407 point All-Star
    • NC01
    • Member since 08-26-2005, 3:33 PM
    • Posts 14,233
    • TrustedFriends-MVPs

    Try this:

    dim button1 as new button
    button1.ID = "btnTest1"
    button1.text="abc"
    tc.control.add(button1)

    AddHandler button1.Click, AddressOf Me.Button1_Click

    ' Rest of code

    ' Declare the event handler...
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
         Me.Response.Write("Button1_Click fired. " & (CType(sender, Button)).ClientID & "<br>")
    End Sub

    NC...

Page 1 of 1 (3 items)