Adding dynamic button

Hi,

I currently loop through a dataset and set out a table as follows:

 For Each dv2 As DataRowView In DvTheData2
                test1.Text += "<tr><td>" & dv2.Row.Item("Thematch") & "</td>" & colourcodeit(dv2.Row.Item("HAG"), "") & colourcodeit(dv2.Row.Item("AAG"), "") & colourcodeit(dv2.Row.Item("VAG"), "") & "</tr>"
            Next

Open in new window


I would like to add a button to the table with the value on Thematch -> this way i can add the match to my database to save later

The code would look something like this

 For Each dv2 As DataRowView In DvTheData2
                test1.Text += "<tr><td>" & dv2.Row.Item("Thematch") & "</td>" & colourcodeit(dv2.Row.Item("HAG"), "") & colourcodeit(dv2.Row.Item("AAG"), "") & colourcodeit(dv2.Row.Item("VAG"), "") & "<td>THEBUTTONGOESHERE</td></tr>"
            Next

Open in new window



How can i do this?
runnerjp2005Asked:
Who is Participating?
 
CodeCruiserCommented:
You can create a javascript function which can call your code behind to do the database option. Then produce the html button control so that it calls the javascript function and passes the row information to it.
0
 
CodeCruiserCommented:
Do you want it to be a html input control and then handle it using Javascript?
0
 
runnerjp2005Author Commented:
Thats not something i have looked into... how would that work?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
runnerjp2005Author Commented:
basicly its just button click....add row to database
them if button is clicked again remove from database
0
 
CodeCruiserCommented:
Where is this html rendered to?
0
 
runnerjp2005Author Commented:
i label on the from page
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.