Hey everyone,
hope your fridays are going well, not long until the weekend now! I could
do
with your help. Once again I've been mistaken for a pro web developer and
asked
to do something I have no clue about! I need to add an Yes / No dialog box
for
a form option which deletes a users details from a database table. Many
thanks
for you help.
1. asp button at the end of the form runs a onclick function
2. dialog box shows asking "Are you sure you want to delete you details?
Buttons - Yes / No"
3. Selecting 'No' stops the form from submitting, selecting 'Yes' submits
the
form.
I have found this code but am not sure how to implement it:
function confirmDelete() {
return window.confirm("are you sure?");
}
in Page_Load function:
Button1.Attributes.Add("OnClick", "return confirmDelete()")
if its in DataGrid Item Template
Dim i As Integer
For i = 0 To DataGrid1.Items.Count - 1
Dim Btn as Button = DataGrid1.Item(i).FindControl("Button1")
Btn.Attributes.Add("OnClick", "return confirmDelete()")