DataGrid and JavaScript

F

Feniks

I have a DataGrid with data coming out of a database and I can execute
delete, update and other operations, it all works fine.
However, I would like a javascrip confirm window to come out whenever I want
to delete a recordset from a database, so the recordset will be deleted
only if a user clicks "OK" on that window. Otherwise, if a user clicks
"CANCEL", nothing will be deleted.
How do I do that?
Thanks!
 
F

Feniks

That's right and you helped me! Thanks!

Jenny K said:
Feniks said:
I have a DataGrid with data coming out of a database and I can execute
delete, update and other operations, it all works fine.
However, I would like a javascrip confirm window to come out whenever I want
to delete a recordset from a database, so the recordset will be deleted
only if a user clicks "OK" on that window. Otherwise, if a user clicks
"CANCEL", nothing will be deleted.
How do I do that?
Thanks!

I'm guess you're clicking on a LinkButton or something. Just add some DHTML
to whatever it is you're clicking. I usually add code similar to the
following to the ItemDataBound event of my datagrids.

LinkButton lbVerify;
lbVerify = (LinkButton)tdMyButtonColumn.Controls[0];
lbVerify.Attributes.Add("onclick","if(confirm("Are you sure?')){return
true;}else{return false;}");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top