Results 1 to 3 of 3

Thread: calling a vb.net function in html

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    calling a vb.net function in html

    I have this html table that lists all buildings available for the user to select, upon clicking on a desired building I would like to create a confirmation in a label on the same page.

    Is there a way I could call a function I created in vb.net using HTML possibly using the <a> tag. Or should I be doing this a completely different way.

    Any help would be appreciated.

    Thanks.

  2. #2
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306

    Re: calling a vb.net function in html

    Yea, how is the table created? Assuming its dynamically?

    One way would be; when creating the text for building names in the table, create them as linkbuttons and add a handler to them.

    e.g:

    Code:
    Public Sub DisplayBuildings()
      Dim MyLnk as LinkButton
    
      'Start of existing Loop for Buildings
        MyLnk = New LinkButton
        'Should set a unique ID here - MyLnk.ID = "Building123" etc
        MyLnk.Controls.Add(New LiteralControl("Building Name"))
        MyLnk.CommandArgument = <Building Unique ID>  'Database Identifier...
    
        AddHandler MyLink.Click, AddressOf BuildingClicked
    
        'e.g:
        Table.Cell.Controls.Add(MyLnk)
      'End Loop
    
    End Sub
    
    Private Sub BuildingClicked(ByVal sender As Object, ByVal e As System.EventArgs)
      Dim MyLnk as Linkbutton = Ctype(sender,LinkButton)
      <Building Unique ID> = MyLnk.CommandArgument
      'Do stuff with building here....
      'Note that this will be in postback so probably want
      'to redirect user in here as well
      'e.g:
      Response.Redirect("/building.aspx?id=" & <Building Unique ID>)
    End sub
    I've just hammered this in from memory, apologies if its missing stuff

    Hope it helps

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: calling a vb.net function in html

    Thats great, I will try that out right away.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width