|
-
Dec 16th, 2004, 02:18 PM
#1
Thread Starter
Addicted Member
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.
-
Dec 20th, 2004, 11:31 AM
#2
Hyperactive Member
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
-
Dec 20th, 2004, 11:34 AM
#3
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|