D
Dotnet Guy
I want to add a confirmation dialog box before I delete
the records in my form.
I have a piece of javascript code in html that checks for
confirmation. But the main issue lies in calling this
javascript function on pagebehind.
function confirm_delete()
{
if (confirm("Are you sure you want
to delete this item?")==true)
return true;
else
return false;
}
I use btndelete.attributes.add("onclick", "return
confirm_delete();") in the page load event which also
works fine.
But this event fires each time I click the button,
irrespective of whether there are records or not. And I do
not want this to happen. I want this confirmation to pop
up only when the form contains the records.
I also tried putting in an if condition around it like:
if txtID.text<>""
btndelete.attributes.add("onclick", "return confirm_delete
();")
End if
But this works fine only for the first time. Sometimes it
would'nt work also.
Please help.
the records in my form.
I have a piece of javascript code in html that checks for
confirmation. But the main issue lies in calling this
javascript function on pagebehind.
function confirm_delete()
{
if (confirm("Are you sure you want
to delete this item?")==true)
return true;
else
return false;
}
I use btndelete.attributes.add("onclick", "return
confirm_delete();") in the page load event which also
works fine.
But this event fires each time I click the button,
irrespective of whether there are records or not. And I do
not want this to happen. I want this confirmation to pop
up only when the form contains the records.
I also tried putting in an if condition around it like:
if txtID.text<>""
btndelete.attributes.add("onclick", "return confirm_delete
();")
End if
But this works fine only for the first time. Sometimes it
would'nt work also.
Please help.